Skip to content Skip to sidebar Skip to footer

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
Copy

component.ts

ngOnInit() {
this.authorized= this.authService.isLoggedIn;
}

service.ts

get isLoggedIn(): boolean {
    return this.currentUser != null; //you can decide to return true or false
 }
get currentuser(): 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"