我有这个功能,但当我把这条线开始: 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");
}
);
}