Browse Source

datepicker-requirements-right-below-date-picker-implementation

pull/2133/head
bartvanhoey 6 years ago
parent
commit
1569ebcd1a
  1. 40
      docs/en/Tutorials/Angular/Part-II.md

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

@ -218,25 +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
//...
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).
#### Datepicker Requirements
You need to import `NgbDatepickerModule` to the `books.module.ts`:
@ -268,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