auth.services.ts file ( Function for call API )
public web_url = ‘URL PATH’;
-> register(user) {
//debugger;
alert(this.web_url);
var reply = this.http.post((this.web_url+“register”),user).map((response: Response) => {
//debugger;
response.json() }
);
return reply;
}
signup.component.ts
-> public onRegister() {
alert(JSON.stringify(this.user));
console.log(this.user);
//debugger;
var response = this.authService.register(this.user).subscribe(
data => {
var results = data;
//debugger;
console.log(results);
}
);
this.router.navigate(["/login"]);
}
=>> Got undefined in response , any suggestion please ??