我有以下代码块,我不确定为什么checkBalidUser()方法在subscribe块中以及subscribe方法中都没有被识别。我得到的打字稿错误是“ts”找不到名称'checkValidUser'。“有人能告诉我这个问题是什么吗?
this.svsOrders.newOrderDetails(customerInfo).subscribe(
(data:any)=>checkValidUser(),
error=>this.errorMessage=<any>error
)
checkValidUser():void(){
//IF-ELSE CODE BLOCK ONE
if (data == 'Invalid User') {
this.isValidUser=false;
let alert = this.alertCtrl.create({
title: 'Submit Order',
message: 'Access Denied',
buttons: [
{
text: 'Ok',
role: 'cancel',
handler: () => {
console.log('Cancel clicked');
}
}],
enableBackdropDismiss: false
});
alert.present();
} //close if
else {
this.svsSummary.newOrderInfo(data);
} //close else
//IF-ELSE CODE BLOACK TWO
if(this.isValidUser){
console.log('isValidUser value(TRUE)', this.isValidUser)
this.navCtrl.setRoot(CategoryPage);
this.navCtrl.popToRoot;
this.svsSummary.clearItemList();
return
} else {
console.log('popping the page now.....')
this.navCtrl.pop();
}
}
谢谢你, AJ
答案 0 :(得分:0)
第2行,应该是this.checkValidUser()
?