Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { Component, OnInit } from '@angular/core';
- import { AuthenticationService } from '../authentication.service';
- @Component({
- selector: 'app-login',
- templateUrl: './login.component.html',
- styleUrls: ['./login.component.css'],
- providers: [AuthenticationService]
- })
- export class LoginComponent implements OnInit {
- credentials: {
- username: '',
- password: ''
- };
- constructor(private _authenticationService: AuthenticationService) {}
- ngOnInit() { }
- login() {
- this._authenticationService.login(this.credentials).subscribe(
- response => console.log(response),
- error => console.log(error),
- () => console.log('Done.')
- );
- }
- import { Http } from '@angular/http';
- import { Injectable } from '@angular/core';
- @Injectable()
- export class AuthenticationService {
- constructor() { }
- login(credentials) {
- console.log(credentials); // This is undefined
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement