@ -347,9 +347,9 @@ This is a fully working, server side paged, sorted and localized table of books.
## Install NPM packages
## Install NPM packages
> Notice: This tutorial is based on the ABP Framework v3.0.3+ If your project version is older, then please upgrade your solution. See the [migration guide](../UI/Angular/Migration-Guide-v3.md) if you are upgrading an existing project with v2.x.
> Notice: This tutorial is based on the ABP Framework v3.1.0+ If your project version is older, then please upgrade your solution. See the [migration guide](../UI/Angular/Migration-Guide-v3.md) if you are upgrading an existing project with v2.x.
If you haven't done it before, open a new command line interface (terminal window) and go to your `angular` folder and then run `yarn` command to install NPM packages:
If you haven't done it before, open a new command line interface (terminal window) and go to your `angular` folder and then run `yarn` command to install the NPM packages:
```bash
```bash
yarn
yarn
@ -473,9 +473,9 @@ Run the following command in the `angular` folder:
abp generate-proxy
abp generate-proxy
```
```
The generated files looks like below:
This command will create the following files under the `/src/app/proxy/books` folder:
@ -819,7 +814,6 @@ export class BookComponent implements OnInit {
* Imported `FormGroup`, `FormBuilder` and `Validators` from `@angular/forms`.
* Imported `FormGroup`, `FormBuilder` and `Validators` from `@angular/forms`.
* Added `form: FormGroup` property.
* Added `form: FormGroup` property.
* Added `bookType` property so that you can reach `BookType` enum members from template.
* Added `bookTypes` property as a list of `BookType` enum members. That will be used in form options.
* Added `bookTypes` property as a list of `BookType` enum members. That will be used in form options.
* Injected `FormBuilder` into the constructor. [FormBuilder](https://angular.io/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate needed to build complex forms.
* Injected `FormBuilder` into the constructor. [FormBuilder](https://angular.io/api/forms/FormBuilder) provides convenient methods for generating form controls. It reduces the amount of boilerplate needed to build complex forms.
* Added `buildForm` method to the end of the file and executed the `buildForm()` in the `createBook` method.
* Added `buildForm` method to the end of the file and executed the `buildForm()` in the `createBook` method.
@ -910,8 +904,7 @@ Open `/src/app/book/book.component.ts` and replace the content as below:
```js
```js
import { ListService, PagedResultDto } from '@abp/ng.core';
import { ListService, PagedResultDto } from '@abp/ng.core';
import { Component, OnInit } from '@angular/core';
import { Component, OnInit } from '@angular/core';
import { BookDto, BookType } from './models';
import { BookService, BookDto, bookTypeOptions } from '@proxy/books';
import { BookService } from './services';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
import { FormGroup, FormBuilder, Validators } from '@angular/forms';
// added this line
// added this line
@ -931,11 +924,7 @@ export class BookComponent implements OnInit {
form: FormGroup;
form: FormGroup;
bookType = BookType;
bookTypes = bookTypeOptions;
bookTypes = Object.keys(this.bookType).filter(
(key) => typeof this.bookType[key] === 'number'
);
isModalOpen = false;
isModalOpen = false;
@ -946,7 +935,7 @@ export class BookComponent implements OnInit {