I'm working on a Angular5 free template that I found on github. It contains only one navbar but for my case I have 2 type of users (Admin and Manager) which do not have the same navbar at all. How can I resolve this? How can I redirect each one of them to a different navbar?
This is how the template looks like:
In this picture you can see the file app-sidebar-nav.component.html that uses the file _nav.ts which contains the navbar.
This is the file _nav.ts
I want to add another file called for exemple _nav2.ts that the manager will see after authentication, which is different. And the _nav.ts will be the result that the Admin will see after authentication.
In directory views/pages I have a file called login.component.ts and login.component.html
EDIT :
This is the file authentication.service.ts
@Injectable()
export class AuthenticationService{
private host:string="http://localhost:8080";
private jwtToken=null ;
private roles:Array<any>;
private user:string;
constructor(private http:HttpClient){
}
login(user){
return this.http.post(this.host+"/login",user,{observe: 'response'});
}
getToken(){
return this.jwtToken;
}
isAdmin(){
for(let r of this.roles){
if(r.authority=='ADMIN') return true;}
return false;
}
isManager(){
for(let r of this.roles){
if(r.authority=='MANAGER') return true;}
return false;
}
}