mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2026-03-13 10:22:08 +08:00
fix(angular): module exports
This commit is contained in:
13
angular/src/providers/index.ts
Normal file
13
angular/src/providers/index.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
|
||||
export { AngularDelegate } from './angular-delegate';
|
||||
export { ActionSheetController } from './action-sheet-controller';
|
||||
export { AlertController } from './alert-controller';
|
||||
export { Events } from './events';
|
||||
export { LoadingController } from './loading-controller';
|
||||
export { MenuController } from './menu-controller';
|
||||
export { PickerController } from './picker-controller';
|
||||
export { ModalController } from './modal-controller';
|
||||
export { Platform } from './platform';
|
||||
export { PopoverController } from './popover-controller';
|
||||
export { ToastController } from './toast-controller';
|
||||
export { NavController } from './nav-controller';
|
||||
34
angular/src/providers/nav-controller.ts
Normal file
34
angular/src/providers/nav-controller.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
|
||||
@Injectable()
|
||||
export class NavController {
|
||||
|
||||
private direction = 0;
|
||||
private goBack = false;
|
||||
private stack: string[] = [];
|
||||
|
||||
setGoback() {
|
||||
this.goBack = true;
|
||||
}
|
||||
|
||||
consumeDirection() {
|
||||
if (this.direction === 0) {
|
||||
const index = this.stack.indexOf(document.location.href);
|
||||
if (index === -1) {
|
||||
this.stack.push(document.location.href);
|
||||
this.direction = 1;
|
||||
} else if (index < this.stack.length - 1) {
|
||||
this.stack = this.stack.slice(0, index + 1);
|
||||
this.direction = -1;
|
||||
}
|
||||
}
|
||||
|
||||
const direction = this.goBack
|
||||
? -1
|
||||
: this.direction;
|
||||
|
||||
this.goBack = false;
|
||||
this.direction = 0;
|
||||
return direction;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user