Advertisement
fabiobiondi

Angular @Directive: hide dom when token is null

May 30th, 2017
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @Directive({
  2.   selector: '[ifLogged]'
  3. })
  4. export class AuthProtectDirective {
  5.   constructor(private user: User ) { }
  6.   @HostBinding('style.display') get display() {
  7.     return this.user.token ? null : 'none';
  8.   }
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement