Here is the UserDetails class defined:
export class UserDetails {
name:string;
phoneNumber:string;
email:string;
password: string;
}
Below is a service where userDetails are utilized::
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { userDetails } from './_models/index';
import 'rxjs/add/operator/map'
@Injectable()
export class AuthenticationService {
private loginUserUrl="http://localhost:8082/TodoApp/login";
constructor(private http: HttpClient) {
//let user = new UserDetails();
}
login(email: string, password: string) {
console.log("in login service");
let user = new User();
user.email=email;
user.password=password;
return this.http.post(this.loginUserUrl,user)
.map(user => {
// login successful if there's a jwt token in the
response
if (user && user.token) {
// store user details and jwt token in local storage to keep user logged in between page refreshes
localStorage.setItem('currentUser', JSON.stringify(user));
}
return user;
});
}
}
Error: ReferenceError: UserDetails is not defined at AuthenticationService.login (webpack-internal:///../../../../../src/app/_services/authentication.service.ts:25)