Angular 6 - Why use @ngrx/store rather than service injection

后端 未结 3 1007
萌比男神i
萌比男神i 2020-12-07 18:21

I am recently learning Angular 6 with @ngrx/store while one of the tutorial is to use @ngrx/store for state management, however I don\'t understand the benefit of us

3条回答
  •  粉色の甜心
    2020-12-07 18:52

    There is also a 3rd option, having data in service and using service directly in html, for instance *ngFor="let item of userService.users". So when you update userService.users in service after add or update action is automatically rendered in html, no need for any observables or events or store.

提交回复
热议问题