@ -308,4 +308,399 @@ Swagger has a nice UI to test APIs. You can try to execute the `[GET] /api/app/b
### Create the Books Page
### Create the Books Page
It's time to create something visible and usable!
It's time to create something visible and usable!
In this Angular Application, [Angular CLI](https://angular.io/cli) will be used to creating modules, components, services, etc. , [NGXS](https://ngxs.gitbook.io/ngxs/) will be used as state management and [Ng Bootstrap](https://ng-bootstrap.github.io/#/home) will be used as the UI library.
Open a terminal window and go to `angular` folder and then run `yarn` command for installing packages.
Run the following command line for creating `BooksModule`
```bash
yarn ng generate module books --route books --module app.module
If you would like to see your route on the navigation bar of `LayoutApplication`, you must add the `data` object with `name` property in your route.
>ABP themes have three layouts. These layouts are `LayoutApplication`, `LayoutAccount` and `LayoutEmpty`. [Check these layouts.](https://github.com/abpframework/abp/tree/dev/npm/ng-packs/packages/theme-basic/src/lib/components)
>See the [Selectors on NGXS Document](https://ngxs.gitbook.io/ngxs/concepts/select#memoized-selectors)
You ready to get books and list in the table.
```typescript
import { Component, OnInit } from '@angular/core';
import { Store, Select } from '@ngxs/store';
import { BooksState } from '../../store/states';
import { Observable } from 'rxjs';
import { Books } from '../../store/models';
import { GetBooks } from '../../store/actions';
@Component({
selector: 'app-book-list',
templateUrl: './book-list.component.html',
styleUrls: ['./book-list.component.scss'],
})
export class BookListComponent implements OnInit {
@Select(BooksState.getBooks)
books$: Observable<Books.Book[]>;
booksType = Books.Type;
loading = false;
constructor(private store: Store) {}
ngOnInit() {
this.loading = true;
this.store.dispatch(new GetBooks())
.subscribe(() => {
// This subscribe block runs when the action completed successfully
this.loading = false
};
}
}
```
>See the [Dispatching Actions](https://ngxs.gitbook.io/ngxs/concepts/store#dispatching-actions) and [Select](https://ngxs.gitbook.io/ngxs/concepts/select) on NGXS Document
Copy next code block to `book-list.component.html`.