Front end of the Slack clone application.

nav-pop.js 1.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. import { Directive, HostListener, Optional } from '@angular/core';
  2. import { NavController } from '../../navigation/nav-controller';
  3. /**
  4. * @name NavPop
  5. * @description
  6. * Directive to declaratively pop the current page off from the
  7. * navigation stack.
  8. *
  9. * @usage
  10. * ```html
  11. * <ion-content>
  12. *
  13. * <button ion-button navPop>Go Back</button>
  14. *
  15. * </ion-content>
  16. * ```
  17. *
  18. * Similar to {@link /docs/api/components/nav/NavPush/ `NavPush` }
  19. * @demo /docs/demos/src/navigation/
  20. * @see {@link /docs/components#navigation Navigation Component Docs}
  21. * @see {@link ../NavPush NavPush API Docs}
  22. */
  23. export class NavPop {
  24. constructor(_nav) {
  25. this._nav = _nav;
  26. if (!_nav) {
  27. console.error('navPop must be within a NavController');
  28. }
  29. }
  30. /**
  31. * @hidden
  32. */
  33. onClick() {
  34. // If no target, or if target is _self, prevent default browser behavior
  35. if (this._nav) {
  36. this._nav.pop().catch(() => {
  37. (void 0) /* console.debug */;
  38. });
  39. return false;
  40. }
  41. return true;
  42. }
  43. }
  44. NavPop.decorators = [
  45. { type: Directive, args: [{
  46. selector: '[navPop]'
  47. },] },
  48. ];
  49. /** @nocollapse */
  50. NavPop.ctorParameters = () => [
  51. { type: NavController, decorators: [{ type: Optional },] },
  52. ];
  53. NavPop.propDecorators = {
  54. 'onClick': [{ type: HostListener, args: ['click',] },],
  55. };
  56. //# sourceMappingURL=nav-pop.js.map