Angular To Update Ui From The Child Component Reflect The Value To The Parent Component
I, am using *IF-else statement in angular 5. If the authorization value is true the template 2 should render if not template 1 should render. Here is the code
Solution 1:
.html
<div *ngIf="authorized; then picUrl else login"></div>
component.ts
ngOnInit() {
this.authorized= this.authService.isLoggedIn;
}
service.ts
getisLoggedIn(): boolean {
returnthis.currentUser != null; //you can decide to return true or false
}
getcurrentuser(): user{
let user = localstorage.getitem('details')
return user;
}
Post a Comment for "Angular To Update Ui From The Child Component Reflect The Value To The Parent Component"