33 lines
799 B
TypeScript
33 lines
799 B
TypeScript
import { Component, OnInit } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
import { LoginService } from '../services/login.service';
|
|
import { User } from '../interfaces/user';
|
|
|
|
@Component({
|
|
selector: 'app-login',
|
|
templateUrl: './login.page.html',
|
|
styleUrls: ['./login.page.scss'],
|
|
})
|
|
export class LoginPage implements OnInit {
|
|
|
|
username: string;
|
|
password: string;
|
|
user: User;
|
|
|
|
constructor(private router: Router, private loginService: LoginService) { }
|
|
|
|
ngOnInit() {
|
|
this.user = this.loginService.user;
|
|
}
|
|
|
|
login() {
|
|
|
|
this.username = (<HTMLInputElement>document.getElementById("username")).value;
|
|
this.password = (<HTMLInputElement>document.getElementById("password")).value;
|
|
this.loginService.validateUser(this.username, this.password)
|
|
|
|
|
|
}
|
|
|
|
}
|