cannot read property 'subscribe' of undefined in Angular
cannot read property 'subscribe' of undefined in Angular
You will get this error when you initialize the subject as below.
public tokenAcquired: Subject<any>;
and calling subscribe method over it as below.
this.appService.tokenAcquired.subscribe((token) => {
this.getApps();
})
Solution - To fix this error declare and initialize the subject as below.
Comments
Post a Comment