Guest User

Untitled

a guest
Aug 17th, 2018
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import {AuthService} from '../services/auth.service';
  3.  
  4. @Component({
  5. selector: 'app-login',
  6. templateUrl: './login.component.html',
  7. styleUrls: ['./login.component.css']
  8. })
  9. export class LoginComponent implements OnInit {
  10. message: string;
  11. constructor(private authService: AuthService) { }
  12.  
  13. ngOnInit() {
  14. }
  15.  
  16. login(username: string, password: string): boolean {
  17. this.message = '';
  18. if (!this.authService.login(username, password)) {
  19. this.message = 'Incorrect credentials.';
  20. setTimeout(function() {
  21. this.message = '';
  22. }.bind(this), 2500);
  23. }
  24. return false;
  25. }
  26. logout(): boolean {
  27. this.authService.logout();
  28. return false;
  29. }
  30. }
Add Comment
Please, Sign In to add comment