本文整理汇总了TypeScript中ionic-angular.App类的典型用法代码示例。如果您正苦于以下问题:TypeScript App类的具体用法?TypeScript App怎么用?TypeScript App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了App类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: if
this.emailProvider.EmailServerLogin(id,password).then((res:any)=>{
console.log("MyApp:"+JSON.stringify(res));
if(res.result=="success"){
if(res.userInfo.hasOwnProperty("shopList")){
//save shoplist
this.storageProvider.shoplistSet(JSON.parse(res.userInfo.shopList));
}
this.storageProvider.emailLogin=true;
this.storageProvider.userInfoSetFromServer(res.userInfo);
this.app.getRootNav().setRoot(TabsPage);
}else if(res.result=='failure'&& res.error=='multiLogin'){
// How to show user a message here? move into error page?
// Is it possible to show alert here?
this.app.getRootNav().setRoot(MultiloginPage,{id:id});
}else{
console.log("사용자 정보에 문제가 발생했습니다. 로그인 페이지로 이동합니다.");
this.app.getRootNav().setRoot(LoginPage);
}
},login_err =>{
示例2: if
this.kakaoProvider.login().then((res:any)=>{
console.log("MyApp:"+JSON.stringify(res));
if(res.result=="success"){
//save shoplist
if(res.userInfo.hasOwnProperty("shopList")){
this.storageProvider.shoplistSet(JSON.parse(res.userInfo.shopList));
}
this.storageProvider.userInfoSetFromServer(res.userInfo);
this.app.getRootNav().setRoot(TabsPage);
}else if(res.result=='failure' && res.result=='invalidId'){
console.log("사용자 정보에 문제가 발생했습니다. 로그인 페이지로 이동합니다.");
this.app.getRootNav().setRoot(LoginPage);
}else if(res.result=='failure'&& res.error=='multiLogin'){
// How to show user a message here? move into error page?
// Is it possible to show alert here?
this.app.getRootNav().setRoot(MultiloginPage,{id:"kakao"});
}else{
console.log("invalid result comes from server-"+JSON.stringify(res));
//this.storageProvider.errorReasonSet('로그인 에러가 발생했습니다');
//this.app.getRootNav().setRoot(ErrorPage);
}
},login_err =>{
示例3: resolve
(response: any) => {
if (response.meta.return_code == 0) {
if (response.data) {
resolve(response.data)
loader.dismiss()
} else {
reject("bad request")
loader.dismiss()
this.app.getRootNav().pop()
this.toastService.showText("serverUnreachable")
}
} else {
reject("bad request")
loader.dismiss()
this.app.getRootNav().pop()
this.toastService.showString("Error " + response.meta.return_code + ", server says: " + response.meta.message)
}
},
示例4: groupEventClick
private groupEventClick(e: any): void {
// console.debug('courseClick :', e);
this.appCtrl.getRootNav().push('ProductPage', {
...this.navParams.data,
productId: e.product.id,
productItemId: e.product.refProduct.itemId,
shopTypeId: this.shopTypeId,
});
}
示例5: resolve
(response: any) => {
if (response.meta.return_code == 0) {
if (response.data) {
resolve(response.data)
this.storage.set("log-" + suffix, response.data)
logLoader.dismiss()
} else {
reject("bad request")
logLoader.dismiss()
this.app.getRootNav().pop()
this.toastService.showText("serverUnreachable")
}
} else {
reject("bad request")
logLoader.dismiss()
this.app.getRootNav().pop()
this.toastService.showString("Error " + response.meta.return_code + ", server says: " + response.meta.message)
}
}, (error: any, caught: Observable<void>) => {
示例6: productClick
private productClick(e: any, shopTypeId: string, shopId: string): void {
// console.debug('our product :', e);
this.appCtrl.getRootNav().push('ProductPage', {
...this.navParams.data,
productId: e.product.id,
productItemId: e.product.refProduct instanceof ProductItemModel ? e.product.id : undefined,
shopTypeId,
shopId,
});
}
示例7: handleError
//Function to handle Errors
handleError(error, expected?) {
//TODO: Allow for overiding error codes, and using custom callbacks
//Log the error
console.log(error);
//Get our status
let status = error.status;
//Check if we have any callbacks for specific error codes
if (expected) {
for (let i = 0; i < expected.length; ++i) {
if (expected[i].status == status) {
//Launch the call abck and return
expected[i].callback();
return;
}
}
}
if (status == 400) {
//400 Bad Request
this.showToast('Bad Request. Please ensure your input is correct.');
} else if (status == 401) {
//401 Unauthorized
//Logout
this.appAuth.logout();
//Redirect to home
let nav = this.app.getActiveNav();
nav.setRoot(Home);
//Toast the user
this.showToast('Unauthorized. Please log back in.');
} else if (status == 404) {
//Toast the user
this.showToast('Could not be found. Please ensure your input is complete and correct.');
} else if (status == 500) {
//Internal Server Error
//Toast the user
this.showToast('Internal Server Error. Please try making the request again, or at a later time.');
} else {
this.showToast('Error ' + status + ': Please Contact Developers for help.');
}
}
示例8:
this.nativeStorage.getItem("id").then((value:string)=>{
console.log("value:"+value);
if(value==null){
console.log("id doesn't exist");
this.app.getRootNav().setRoot(LoginPage);
return;
}else{
var id=this.storageProvider.decryptValue("id",decodeURI(value));
console.log("id:"+id);
this.loginWithExistingId();
}
});
示例9: expandChartModalLimitsAndExposures
//open Chart in full screen
expandChartModalLimitsAndExposures() {
// Get the same chart data on this page and set title
let chartData = this.chartLimitsAndExposureData;
chartData.title = { text: this.cpInfo.name };
chartData.subtitle = { text: 'Limits & Exposures'};
this.app.getRootNav().push(OnlyChartPage, { "chartData": chartData });
//let modal = this.modalCtrl.create(ChartModalPage, { "chartData": chartData });
//modal.onDidDismiss(()=>{
//});
//modal.present();
}
示例10: nav
private get nav() {
return this.app.getActiveNav();
}