本文整理汇总了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 : '';
//.........这里部分代码省略.........