123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- import { Directive, HostListener, Input, Optional } from '@angular/core';
- import { NavController } from '../../navigation/nav-controller';
- /**
- * @name NavPush
- * @description
- * Directive to declaratively push a new page to the current nav
- * stack.
- *
- * @usage
- * ```html
- * <button ion-button [navPush]="pushPage"></button>
- * ```
- *
- * To specify parameters you can use array syntax or the `navParams`
- * property:
- *
- * ```html
- * <button ion-button [navPush]="pushPage" [navParams]="params">Go</button>
- * ```
- *
- * Where `pushPage` and `params` are specified in your component,
- * and `pushPage` contains a reference to a
- * component you would like to push:
- *
- * ```ts
- * import { LoginPage } from './login';
- *
- * @Component({
- * template: `<button ion-button [navPush]="pushPage" [navParams]="params">Go</button>`
- * })
- * class MyPage {
- * pushPage: any;
- * params: Object;
- * constructor(){
- * this.pushPage = LoginPage;
- * this.params = { id: 42 };
- * }
- * }
- * ```
- *
- * @demo /docs/demos/src/navigation/
- * @see {@link /docs/components#navigation Navigation Component Docs}
- * @see {@link ../NavPop NavPop API Docs}
- *
- */
- export class NavPush {
- constructor(_nav) {
- this._nav = _nav;
- if (!_nav) {
- console.error('navPush must be within a NavController');
- }
- }
- /**
- * @hidden
- */
- onClick() {
- if (this._nav && this.navPush) {
- this._nav.push(this.navPush, this.navParams);
- return false;
- }
- return true;
- }
- }
- NavPush.decorators = [
- { type: Directive, args: [{
- selector: '[navPush]'
- },] },
- ];
- /** @nocollapse */
- NavPush.ctorParameters = () => [
- { type: NavController, decorators: [{ type: Optional },] },
- ];
- NavPush.propDecorators = {
- 'navPush': [{ type: Input },],
- 'navParams': [{ type: Input },],
- 'onClick': [{ type: HostListener, args: ['click',] },],
- };
- //# sourceMappingURL=nav-push.js.map
|