UNPKG

@this-dot/route-config

Version:

A library containing directives and services for configuring components via Route's routeData property

34 lines (33 loc) 2.25 kB
import { OnInit, TemplateRef, ViewContainerRef } from '@angular/core'; import { RouteDataHasService } from './route-data-has.service'; import * as i0 from "@angular/core"; /** * If you need to use a different route data property to store the tags, you can use the `*tdRouteDataHas` directive. It works very similar to `*tdRouteTag` directive but provides a way to use different properties as a source of data. * * @example * <!-- You can configure the directive to use the `customDataProperty` property of the route data object, where it looks for the `customShow` property to determine if the element needs to show: * <p *tdRouteDataHas="'customShow'; propName: 'customDataProperty'"> * This text is only visible, if there is a 'show' tag in the route data's `customDataProperty` Array * </p> * * @example * <!-- `*tdRouteDataHas` also provides a way do display a fallback template if a given tag is not present --> * <p *tdRouteDataHas="'customShow'; propName: 'customDataProperty'; else noShowTag"> * This text is only visible, if there is a 'customShow' tag in the route data's `customDataProperty` Array * </p> * <ng-template #noShowTag> * <p>There is no 'customShow' tag in this route's config</p> * </ng-template> */ export declare class RouteDataHasDirective<CThen, CElse, RouteTags extends string = string> implements OnInit { private template; private viewContainer; private routeDataHasService; set tdRouteDataHas(tags: RouteTags | RouteTags[]); set tdRouteDataHasPropName(propName: string); set tdRouteDataHasElse(elseTemplate: TemplateRef<CElse>); constructor(template: TemplateRef<CThen>, viewContainer: ViewContainerRef, routeDataHasService: RouteDataHasService<CThen, CElse, RouteTags>); ngOnInit(): void; static ɵfac: i0.ɵɵFactoryDeclaration<RouteDataHasDirective<any, any, any>, never>; static ɵdir: i0.ɵɵDirectiveDeclaration<RouteDataHasDirective<any, any, any>, "[tdRouteDataHas]", never, { "tdRouteDataHas": { "alias": "tdRouteDataHas"; "required": false; }; "tdRouteDataHasPropName": { "alias": "tdRouteDataHasPropName"; "required": false; }; "tdRouteDataHasElse": { "alias": "tdRouteDataHasElse"; "required": false; }; }, {}, never, never, false, never>; }