Guest User

Untitled

a guest
Oct 5th, 2018
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. public isloggedin :boolean;
  2.  
  3. loginU(e){
  4. e.preventDefault();
  5. console.log(e);
  6. const username = e.target.elements[0].value;
  7. const password = e.target.elements[1].value;
  8. console.log(username, password);
  9.  
  10.  
  11. if (username === 'admin' && password === 'admin'){
  12. console.log(e);
  13. this.isloggedin = true;
  14. this.router.navigate(['/dashboard']);
  15. return this.isloggedin
  16. } else
  17. {
  18. this.loginStatus = 'Invalid Username/Password';
  19.  
  20. }
  21. }
  22.  
  23. import {LoginComponent} from '../login/login.component';
  24. constructor private _login: LoginComponent) {
  25. ngOnInit() {
  26. console.log("From header " + this._login.isloggedin)
  27. }
  28.  
  29. <button *ngIf="_login.isloggedin" mat-button (click)="logout()" style="outline:none;margin-left: 5px;float: right;"><i class="material-icons" style="color: white;">
  30. power_settings_new
  31. </i></button>
Add Comment
Please, Sign In to add comment