It's turning out that 2019 is the year of the Observable store at ng-conf with several speakers advocating for this pattern in Angular apps.
I rec...
For further actions, you may consider blocking this person and/or reporting abuse
Yes, this is a good call and how I actually implemented it. I think I used this.state merely as a clear example in the write up.
I've used Observable.store in 2 in my freelance projects. Really love the simplicity it offered.
This is some good stuff. Thanks for this insight. I have implemented a simple store with BehaviorSubject before. But your implementation is such more clearer and cleaner. Thanks again for the post.
Great article! I love the simplicity of this approach. But I wonder, why you used EventEmitter for emitting new actions instead of Subject? AFAIK usage of EventEmitter is discouraged by Angular team for anything except sharing events between components. Was there some good reason to use EventEmitter specifically in this case? Thank you!
It’s been awhile since I looked at this but I think the rationale was exactly that, for sharing. If Subject works for you, go for it!
Great read, thanks. I've never been a fan of ngrx and I've worked with BehaviourSubjects before as well. A very nice way of implementing this pattern.
Do you have a git repo with this example?
Hello.
I love this great article.
But, I got a question.
When should I use state?
get state(): AbstractState {
return this._state$.getValue();
}
Template should not consume store.state?
In this simple expression of an Observable store you can do something like this in a template.
I've missed something. what is AbstractAction ?
AbstractAction is a placeholder interface for actions, which you can override with another interface that more clearly defines the action in any class that extends the Store class.