Reputation: 21
I am not able to get HTTP data response.
onSubmit(form: any): void {
this.dataResponse = this._userService.userAuthenticate(form);
**console.log(this.dataResponse);**
if (this.dataResponse.status == 'Gajanand')
{
this._router.navigate(['dashboard', "index",34 , "subjectid", 45]);
}
}
Upvotes: 0
Views: 45
Reputation: 155
It looks like userService is returning a promise. Just simple put your if in a fat arrow function and handle that promise correctly
onSubmit(form: any): void {
this._userService.userAuthenticate(form).then(dataResponse => {
if (dataResponse.status == 'Gajanand') {
this._router.navigate(['dashboard', "index",34 , "subjectid", 45]);
}
});
}
Upvotes: 1