Front end of the Slack clone application.

nav-pop-anchor.js 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import { Directive, Optional } from '@angular/core';
  2. import { DeepLinker } from '../../navigation/deep-linker';
  3. import { ViewController } from '../../navigation/view-controller';
  4. import { NavPop } from './nav-pop';
  5. /**
  6. * @hidden
  7. */
  8. export class NavPopAnchor {
  9. constructor(host, linker, viewCtrl) {
  10. this.host = host;
  11. this.linker = linker;
  12. this.viewCtrl = viewCtrl;
  13. }
  14. updateHref() {
  15. if (this.host && this.viewCtrl) {
  16. const previousView = this.host._nav.getPrevious(this.viewCtrl);
  17. this._href = (previousView && this.linker.createUrl(this.host._nav, this.viewCtrl.component, this.viewCtrl.data)) || '#';
  18. }
  19. else {
  20. this._href = '#';
  21. }
  22. }
  23. ngAfterContentInit() {
  24. this.updateHref();
  25. }
  26. }
  27. NavPopAnchor.decorators = [
  28. { type: Directive, args: [{
  29. selector: 'a[navPop]',
  30. host: {
  31. '[attr.href]': '_href'
  32. }
  33. },] },
  34. ];
  35. /** @nocollapse */
  36. NavPopAnchor.ctorParameters = () => [
  37. { type: NavPop, decorators: [{ type: Optional },] },
  38. { type: DeepLinker, },
  39. { type: ViewController, decorators: [{ type: Optional },] },
  40. ];
  41. //# sourceMappingURL=nav-pop-anchor.js.map