本文整理汇总了TypeScript中ionic-angular.NavController.getActive方法的典型用法代码示例。如果您正苦于以下问题:TypeScript NavController.getActive方法的具体用法?TypeScript NavController.getActive怎么用?TypeScript NavController.getActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ionic-angular.NavController
的用法示例。
在下文中一共展示了NavController.getActive方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: constructor
constructor(
private nav: NavController,
private locationProvider: LocationProvider
) {
const activeNav = this.nav.getActive()
this.locationProvider.getCurrentCity()
.then(city => {
if (city === null && !activeNav) {
this.gotoSettings()
}
})
.catch((err) => {
console.log(err)
})
}
示例2: onBackButton
private onBackButton() {
try {
if (this.menu.isOpen()) {
this.menu.close();
} else {
var activePage = this.navController.getActive();
if (activePage.instance.onBackButton) {
activePage.instance.onBackButton();
} else {
this.navController.pop();
}
}
} catch (err) {
this.loggingService.log("Error onBackButton", err);
}
}
示例3: handleKeyboardEvent
@HostListener('document:keydown', ['$event']) handleKeyboardEvent(event: KeyboardEvent) {
if (this.navCtrl.getActive().name != 'AmountPage') return;
if (!event.key) return;
if (event.which === 8) {
event.preventDefault();
this.removeDigit();
}
if (event.key.match(this.reNr)) {
this.pushDigit(event.key);
} else if (event.key.match(this.reOp)) {
this.pushOperator(event.key);
} else if (event.keyCode === 86) {
if (event.ctrlKey || event.metaKey) this.processClipboard();
} else if (event.keyCode === 13) this.finish();
}
示例4: openPage
openPage(pageID) {
switch(pageID) {
case 0: {
if (this.navCtrl.getActive().component != HomePage) {
this.navCtrl.setRoot(HomePage, {fromSideMenu: true});
}
break;
}
case 1: {
this.navCtrl.push(InfoPage);
break;
}
case 2: {
this.navCtrl.push(ImpressumPage);
break;
}
}
}
示例5:
navTransition.then(() => {
let elementRef:ElementRef = this.navController.getActive().contentRef();
this.cacheService.cacheImages($(elementRef.nativeElement).find('img'));
});
示例6: removePageFromHistory
protected removePageFromHistory() {
const startIndex = this.navCtrl.getActive().index - 1;
this.navCtrl.remove(startIndex, 1);
}
示例7: shouldDisplaySettingsLink
get shouldDisplaySettingsLink() {
const activeNav = this.nav.getActive()
if (activeNav) {
return activeNav.component.name !== 'SettingsPage'
}
}
示例8: 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 : '';
//.........这里部分代码省略.........