You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-4Lines changed: 12 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,6 +12,8 @@ multiple model support and immutable data exposed as RxJS Observable.
12
12
-[Code of Conduct](https://github.com/angular-extensions/model/blob/master/CODE_OF_CONDUCT.md)
-[Blog](https://medium.com/@tomastrajan/model-pattern-for-angular-state-management-6cb4f0bfed87) about introduction to Angular Model Pattern
16
+
-[Advanced Usage Patterns](https://tomastrajan.github.io/angular-model-pattern-example#/advanced) with more how-tos and examples
15
17
16
18
## Documentation
17
19
@@ -70,7 +72,7 @@ multiple model support and immutable data exposed as RxJS Observable.
70
72
71
73
4. Use our new `<app-todo></app-todo>` component in the template of the `app.component.html`
72
74
73
-
Please mind that you might be using different application prefix than `app-` o adjust accordingly.
75
+
Please mind that you might be using different application prefix than `app-` so adjust accordingly.
74
76
75
77
## Model API
76
78
@@ -169,9 +171,15 @@ All the original examples and documentation are still valid. The only difference
169
171
you can add `@angular-extensions/model` with `ng add` instead of installing `ngx-model` or having to copy model pattern
170
172
implementation to your project manually.
171
173
172
-
Check out the [Blog Post](https://medium.com/@tomastrajan/model-pattern-for-angular-state-management-6cb4f0bfed87) and
One of the changes compared to `ngx-model` is that the `@angular-extensions/model` uses new
175
+
`providedIn: 'root'` syntax (since Angular 6) so that we don't need to import `NgxModelModule`
176
+
or anything similar to register `ModelFactory` into Angular dependency injection (DI) context.
177
+
All we have to do is to import `ModelFactory` in the constructor of at least one service in our
178
+
application like this `constructor(private modelFactory: ModelFactory<SomeType[]>) {}` and we're
179
+
good to go. This new feature is called tree-shakeable providers:
180
+
181
+
> There is now a new, recommended, way to register a provider, directly inside the @Injectable() decorator, using the new providedIn attribute. It accepts 'root' as a value or any module of your application. When you use 'root', your injectable will be registered as a singleton in the application, and you don’t need to add it to the providers of the root module. Similarly, if you use providedIn: UsersModule, the injectable is registered as a provider of the UsersModule without adding it to the providers of the module ([source](https://blog.ninja-squad.com/2018/05/04/what-is-new-angular-6/))
0 commit comments