In my component I am getting data from store, like this:
ngOnInit() {
this.appUserName = this.store.pipe(select(subscribe.getAppUserName));
this.store.dispatch(new actions.LoadTranslationIds());
this.data = this.store.pipe(select(subscribe.getTranslationIds));
}
after assigned I am trying to print the "this.data" in 'ngChanges' like:
ngOnChanges() {
console.log('trans id', this.data);
}
But ngOnChanges
itself not triggering. I am not able to console the data what i receives. what is wrong with my code? or what would be the correct approach?
I am not using "subscribe" approach here.
ngOnChanges
only be called when any data-bound property of a directive changes.Why don't you subscribe it.
https://angular.io/api/core/OnChanges