You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
43 lines
1.1 KiB
43 lines
1.1 KiB
import { Component, OnInit } from '@angular/core';
|
|
import { NgForm } from '@angular/forms';
|
|
import { Router } from '@angular/router';
|
|
|
|
import { User } from 'src/app/models/user';
|
|
import { UserService } from 'src/app/services/user.service';
|
|
|
|
@Component({
|
|
selector: 'app-login',
|
|
templateUrl: './login.component.html',
|
|
styleUrls: ['./login.component.css']
|
|
})
|
|
export class LoginComponent implements OnInit {
|
|
// logindata={ emailid: '',
|
|
// passWord: ''}
|
|
user:User
|
|
isFormSubmitted : boolean;
|
|
login(loginForm : NgForm) {
|
|
// console.log(this.logindata)
|
|
console.log(this.user)
|
|
if (loginForm.invalid) {
|
|
return;
|
|
}
|
|
// this.isFormSubmitted=true;
|
|
// this._userService.loginUser(this.user).subscribe(x => { alert("Signup Successful")})
|
|
|
|
if (this.user.username=="shawn@mail.com" && this.user.userpassword=="1234") {
|
|
alert("Correct Credentials...");
|
|
this._router.navigate(['home'])
|
|
} else {
|
|
alert("Invalid Credentials...")
|
|
}
|
|
}
|
|
constructor(private _userService:UserService,private _router:Router) {
|
|
this.user =new User()
|
|
this.isFormSubmitted=false;
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
|
|
}
|