我有這個功能,但當我把這條線開始: this.router.navigate(['/home']);
它的工作原理,但它不工作,當我把它放在哪裏,現在在我的代碼波紋管。任何建議?如何在函數中綁定這個?
submitLogin(values){
// Variable to hold a reference of addComment/updateComment
let loginOperation:Observable<any>;
loginOperation = this.loginService.Login(values);
loginOperation.subscribe(
function(response) { console.log("Success Response" + response)},
function(error) { console.log("Error happened" + error)},
function(){
this.router.navigate(['/home']);
console.log("the subscription is completed");
}
);
}