import { AuthService } from 'src/app/services/auth.service'; import { Component, OnInit, Output } from '@angular/core'; import { User } from '../../../models/userResponse'; @Component({ selector: 'app-navbar', templateUrl: './navbar.component.html', styleUrls: ['./navbar.component.scss'] }) export class NavbarComponent implements OnInit { isLogged: User; isAdmin: boolean = false; constructor(private authService : AuthService) { console.log('Variable', this.isAdmin) this.authService.user_info.subscribe((x) =>{ this.isLogged = x; this.isLogged.role ==='admin' ? this.isAdmin = true : this.isAdmin = false; console.log('Variable dedans', this.isAdmin); }); } ngOnInit(): void { //console.log(this.isLogged) } logOut(){ this.authService.logout() } }