@bespunky/angular-zen
Version:
The Angular tools you always wished were there.
42 lines (41 loc) • 1.81 kB
TypeScript
import { OnDestroy, OnInit } from '@angular/core';
import { RouterOutlet } from '@angular/router';
import { Destroyable } from '@bespunky/angular-zen/core';
import { RouterOutletComponentBus } from './router-outlet-component-bus.service';
import * as i0 from "@angular/core";
/**
* Hooks into a router outlet's events and publishes the current component to the [`RouterOutletComponentBus`](/injectables/RouterOutletComponentBus.html) to create a mapping
* of component instances by outlet name.
*
* Components instantiated by outlets marked with `publishComponent` will be accessible by outlet name in the bus service.
*
* @example
* <!-- Component template -->
* <router-outlet publishComponent name="header"></router-outlet>
* <router-outlet publishComponent ></router-outlet>
* <router-outlet publishComponent name="footer"></router-outlet>
*
* @See `RouterOutletComponentBus` for more details.
*
* @export
* @class PublishComponentDirective
* @extends {Destroyable}
* @implements {OnInit}
*/
export declare class PublishComponentDirective extends Destroyable implements OnInit, OnDestroy {
private outlet;
private componentBus;
private outletName;
constructor(outlet: RouterOutlet, componentBus: RouterOutletComponentBus, outletName: string);
/**
* Registers to outlet events to publish the activated and deactivated components to the bus. *
*/
ngOnInit(): void;
/**
* Unpublishes the outlet from the bus.
*/
ngOnDestroy(): void;
private updateComponentOnBus;
static ɵfac: i0.ɵɵFactoryDeclaration<PublishComponentDirective, [null, null, { attribute: "name"; }]>;
static ɵdir: i0.ɵɵDirectiveDeclaration<PublishComponentDirective, "router-outlet[publishComponent]", never, {}, {}, never, never, false>;
}