Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { NgForm } from '@angular/forms';
  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.  
  11. errorMessage: string;
  12.  
  13. constructor() { }
  14.  
  15. ngOnInit() {
  16. }
  17.  
  18. login(loginForm: NgForm) {
  19. if (loginForm && loginForm.valid) {
  20. const userEmail = loginForm.form.value.userEmail;
  21. const password = loginForm.form.value.password;
  22. alert('Welcome..!!');
  23. console.log(userEmail, password);
  24. } else {
  25. this.errorMessage = 'Please enter a user email and password.';
  26. }
  27. }
  28.  
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement