Guest User

Untitled

a guest
Feb 2nd, 2018
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import {AuthService} from '../../services/auth.service';
  3. import {Router} from '@angular/router';
  4. import {FlashMessagesService} from 'angular2-flash-messages';
  5.  
  6. @Component({
  7. selector: 'app-login',
  8. templateUrl: './login.component.html',
  9. styleUrls: ['./login.component.css']
  10. })
  11. export class LoginComponent implements OnInit {
  12. username: String;
  13. password: String;
  14.  
  15. constructor(
  16. private flashMessage: FlashMessagesService,
  17. private authService: AuthService,
  18. private router: Router) { }
  19.  
  20. ngOnInit() {
  21. }
  22.  
  23.  
  24. onLoginSubmit(){
  25. console.log(this.username);
  26. const user = {
  27. username: this.username,
  28. password: this.password
  29. }
  30.  
  31. this.authService.authenticateUser(user).subscribe(data => {
  32. console.log(data);
  33. });
  34. }
  35.  
  36. }
Add Comment
Please, Sign In to add comment