Skip to content

Instantly share code, notes, and snippets.

@dasmido
Last active January 20, 2018 16:57
Show Gist options
  • Save dasmido/ffa50d9f0c6c8aadbef64849a4e55b51 to your computer and use it in GitHub Desktop.
Save dasmido/ffa50d9f0c6c8aadbef64849a4e55b51 to your computer and use it in GitHub Desktop.
import { Component, OnInit } from '@angular/core';
import {AuthService} from '../../services/auth.service';
import {Router} from '@angular/router';
import {FlashMessagesService} from 'angular2-flash-messages';
@Component({
selector: 'app-login',
templateUrl: './login.component.html',
styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
username: String;
password: String;
constructor(
private flashMessage: FlashMessagesService,
private authService: AuthService,
private router: Router) { }
ngOnInit() {
}
onLoginSubmit(){
console.log(this.username);
const user = {
username: this.username,
password: this.password
}
this.authService.authenticateUser(user).subscribe(data => {
console.log(data);
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment