Skip to content

Commit 689a3a1

Browse files
committed
fix(docs): enhance readme
1 parent d4fd524 commit 689a3a1

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

README.md

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ multiple model support and immutable data exposed as RxJS Observable.
1212
- [Code of Conduct](https://github.com/angular-extensions/model/blob/master/CODE_OF_CONDUCT.md)
1313
- [Contributing](https://github.com/angular-extensions/model/blob/master/CONTRIBUTING.md)
1414
- [Changelog](https://github.com/angular-extensions/model/blob/master/CHANGELOG.md)
15+
- [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
1517

1618
## Documentation
1719

@@ -70,7 +72,7 @@ multiple model support and immutable data exposed as RxJS Observable.
7072
7173
4. Use our new `<app-todo></app-todo>` component in the template of the `app.component.html`
7274
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.
7476
7577
## Model API
7678
@@ -169,9 +171,15 @@ All the original examples and documentation are still valid. The only difference
169171
you can add `@angular-extensions/model` with `ng add` instead of installing `ngx-model` or having to copy model pattern
170172
implementation to your project manually.
171173
172-
Check out the [Blog Post](https://medium.com/@tomastrajan/model-pattern-for-angular-state-management-6cb4f0bfed87) and
173-
[Advanced Usage Patterns](https://tomastrajan.github.io/angular-model-pattern-example#/advanced)
174-
for more how-tos and examples.
174+
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/))
182+
175183
176184
## Contributing
177185

0 commit comments

Comments
 (0)