Browse Source

Merge pull request #2133 from bartvanhoey/datepicker-requirements-right-below-date-picker-implementation

datepicker-requirements-right-below-date-picker-implementation
pull/2253/head
Mehmet Erim 7 years ago
committed by GitHub
parent
commit
4b4901d5bc
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 41
      docs/en/Tutorials/Angular/Part-II.md

41
docs/en/Tutorials/Angular/Part-II.md

@ -218,26 +218,6 @@ Open `book-list.component.html` and add the form in the body template of the mod
> We've used [NgBootstrap datepicker](https://ng-bootstrap.github.io/#/components/datepicker/overview) in this component.
Open the `book-list.component.ts` and then create an array, named `bookTypeArr`:
```js
//...
booksType = Books.BookType;
bookTypeArr = Object.keys(Books.BookType).filter(
bookType => typeof this.booksType[bookType] === 'number'
);
```
> It use the `booksType` field,please put the `bookTypeArr` defined below that line
The `bookTypeArr` contains the fields of the `BookType` enum. Resulting array is shown below:
```js
['Adventure', 'Biography', 'Dystopia', 'Fantastic' ...]
```
This array was used in the previous form template (in the `ngFor` loop).
#### Datepicker Requirements
You need to import `NgbDatepickerModule` to the `books.module.ts`:
@ -269,6 +249,27 @@ export class BookListComponent implements OnInit {
> The `NgbDateAdapter` converts Datepicker value to `Date` type. See the [datepicker adapters](https://ng-bootstrap.github.io/#/components/datepicker/overview) for more details.
Open the `book-list.component.ts` and then create an array, named `bookTypeArr`:
```js
//...
form: FormGroup;
bookTypeArr = Object.keys(Books.BookType).filter(
bookType => typeof this.booksType[bookType] === 'number'
);
```
The `bookTypeArr` contains the fields of the `BookType` enum. Resulting array is shown below:
```js
['Adventure', 'Biography', 'Dystopia', 'Fantastic' ...]
```
This array was used in the previous form template (in the `ngFor` loop).
![new-book-form](images/bookstore-new-book-form.png)
#### Saving the Book

Loading…
Cancel
Save