Skip to content

Commit 295feaa

Browse files
committed
Cleanup and fix code examples
1 parent d103302 commit 295feaa

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

docs/chapter-7.mdx

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,10 @@ We are all set to write the template for the presenter component:
8080

8181
```html title="src/app/category-list/category-list-presenter/category-list-presenter.component.html"
8282
<mat-list>
83-
<mat-list-item *ngFor="let category of categories"
84-
>{{ category.name }}</mat-list-item
85-
>
86-
<.mat-list></mat-list
87-
>
83+
<mat-list-item *ngFor="let category of categories">
84+
{{ category.name }}
85+
</mat-list-item>
86+
</mat-list>
8887
```
8988

9089
Now the only thing left is to select the data from the `Store` in the container component, and pass it as `@Input` to the presenter. To select the data, we need to inject the `Store` into our component. The `Store` is a special service-class from NgRx that allows us to interact with the `State`. To inject that store, we need to import the `StoreModule` into our `AppModule`, and provide the `Reducer` from our previous chapter, so that NgRx knows what is our data an how it is modified. Let's do this:
@@ -141,8 +140,10 @@ import { categories } from "../../state/selectors";
141140

142141
@Component({
143142
selector: "app-category-list-presenter",
144-
template:
145-
'<app-category-list-presenter [categories]="categories$ | async"></app-category-list-presenter>',
143+
template: `
144+
<app-category-list-presenter [categories]="categories$ | async">
145+
</app-category-list-presenter>
146+
`,
146147
})
147148
export class CategoryListContainer {
148149
categories$ = this.store.select(categories);

0 commit comments

Comments
 (0)