本文整理匯總了TypeScript中ionic-angular.App.getActiveNav方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript App.getActiveNav方法的具體用法?TypeScript App.getActiveNav怎麽用?TypeScript App.getActiveNav使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ionic-angular.App
的用法示例。
在下文中一共展示了App.getActiveNav方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: 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.');
}
}
示例2: nav
private get nav() {
return this.app.getActiveNav();
}
示例3: redir
public redir(data: string): boolean {
// TODO Injecting NavController in constructor of service fails with no provider error
this.navCtrl = this.app.getActiveNav();
// data extensions for Payment Protocol with non-backwards-compatible request
if ((/^bitcoin(cash)?:\?r=[\w+]/).exec(data)) {
let coin = 'btc';
if (data.indexOf('bitcoincash') === 0) coin = 'bch';
data = decodeURIComponent(data.replace(/bitcoin(cash)?:\?r=/, ''));
this.payproProvider.getPayProDetails(data, coin).then((details) => {
this.handlePayPro(details, coin);
}).catch((err) => {
this.popupProvider.ionicAlert(this.translate.instant('Error'), err);
});
return true;
}
data = this.sanitizeUri(data);
let amount: string;
let message: string;
let addr: string;
let parsed: any;
let coin: string;
// Bitcoin URL
if (this.bwcProvider.getBitcore().URI.isValid(data)) {
this.logger.debug('Handling Bitcoin URI');
coin = 'btc';
parsed = this.bwcProvider.getBitcore().URI(data);
addr = parsed.address ? parsed.address.toString() : '';
message = parsed.message;
amount = parsed.amount ? parsed.amount : '';
if (parsed.r) {
this.payproProvider.getPayProDetails(parsed.r, coin).then((details) => {
this.handlePayPro(details, coin);
}).catch((err: string) => {
if (addr && amount) this.goSend(addr, amount, message, coin);
else this.popupProvider.ionicAlert(this.translate.instant('Error'), err);
});
} else {
this.goSend(addr, amount, message, coin);
}
return true;
// Cash URI
} else if (this.bwcProvider.getBitcoreCash().URI.isValid(data)) {
this.logger.debug('Handling Bitcoin Cash URI');
coin = 'bch';
parsed = this.bwcProvider.getBitcoreCash().URI(data);
addr = parsed.address ? parsed.address.toString() : '';
// keep address in original format
if (parsed.address && data.indexOf(addr) < 0) {
addr = parsed.address.toCashAddress();
};
message = parsed.message;
amount = parsed.amount ? parsed.amount : '';
// paypro not yet supported on cash
if (parsed.r) {
this.payproProvider.getPayProDetails(parsed.r, coin).then((details: any) => {
this.handlePayPro(details, coin);
}).catch((err: string) => {
if (addr && amount)
this.goSend(addr, amount, message, coin);
else
this.popupProvider.ionicAlert(this.translate.instant('Error'), err);
});
} else {
this.goSend(addr, amount, message, coin);
}
return true;
// Cash URI with bitcoin core address version number?
} else if (this.bwcProvider.getBitcore().URI.isValid(data.replace(/^bitcoincash:/, 'bitcoin:'))) {
this.logger.debug('Handling bitcoincash URI with legacy address');
coin = 'bch';
parsed = this.bwcProvider.getBitcore().URI(data.replace(/^bitcoincash:/, 'bitcoin:'));
let oldAddr = parsed.address ? parsed.address.toString() : '';
if (!oldAddr) return false;
addr = '';
let a = this.bwcProvider.getBitcore().Address(oldAddr).toObject();
addr = this.bwcProvider.getBitcoreCash().Address.fromObject(a).toString();
// Translate address
this.logger.debug('address transalated to:' + addr);
let title = this.translate.instant('Bitcoin cash Payment');
let msg = this.translate.instant('Payment address was translated to new Bitcoin Cash address format: {{addr}}', { addr });
this.popupProvider.ionicConfirm(title, msg).then((res: boolean) => {
if (!res) return false;
message = parsed.message;
amount = parsed.amount ? parsed.amount : '';
//.........這裏部分代碼省略.........