1 import { Component } from '@angular/core';
2 import { Router } from '@angular/router';
4 import { AuthService } from '../shared';
8 template: require('./login.component.html')
11 export class LoginComponent {
15 private authService: AuthService,
16 private router: Router
19 login(username: string, password: string) {
20 this.authService.login(username, password).subscribe(
24 this.router.navigate(['/videos/list']);
29 if (error.error === 'invalid_grant') {
30 this.error = 'Credentials are invalid.';
32 this.error = `${error.error}: ${error.error_description}`;