nav-push-anchor.js 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { Directive, Host, Optional } from '@angular/core';
  2. import { DeepLinker } from '../../navigation/deep-linker';
  3. import { NavPush } from './nav-push';
  4. /**
  5. * @hidden
  6. */
  7. export class NavPushAnchor {
  8. constructor(host, linker) {
  9. this.host = host;
  10. this.linker = linker;
  11. }
  12. updateHref() {
  13. if (this.host && this.linker) {
  14. this._href = this.linker.createUrl(this.host._nav, this.host.navPush, this.host.navParams) || '#';
  15. }
  16. else {
  17. this._href = '#';
  18. }
  19. }
  20. ngAfterContentInit() {
  21. this.updateHref();
  22. }
  23. }
  24. NavPushAnchor.decorators = [
  25. { type: Directive, args: [{
  26. selector: 'a[navPush]',
  27. host: {
  28. '[attr.href]': '_href'
  29. }
  30. },] },
  31. ];
  32. /** @nocollapse */
  33. NavPushAnchor.ctorParameters = () => [
  34. { type: NavPush, decorators: [{ type: Host },] },
  35. { type: DeepLinker, decorators: [{ type: Optional },] },
  36. ];
  37. //# sourceMappingURL=nav-push-anchor.js.map