Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import {AuthService} from '../services/auth.service';
- @Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.css']
- })
- export class LoginComponent implements OnInit {
- message: string;
- constructor(private authService: AuthService) { }
- ngOnInit() {
- }
- login(username: string, password: string): boolean {
- this.message = '';
- if (!this.authService.login(username, password)) {
- this.message = 'Incorrect credentials.';
- setTimeout(function() {
- this.message = '';
- }.bind(this), 2500);
- }
- return false;
- }
- logout(): boolean {
- this.authService.logout();
- return false;
- }
- }
Add Comment
Please, Sign In to add comment