File

projects/dvk/src/lib/content-conductor/content-container/content-container.directive.ts

Description

A directive that can be attached to create a container where content with an attached ContentDirective can be displayed.

The string set to the directive name is used to refer to this container by the ContentConductor.

Implements

ContentContainer

Example

<div dvk-content-container="my-container"></div>

Metadata

selector [dvk-content-container]

Index

Inputs

Constructor

constructor(vcRef: ViewContainerRef, ccService: ContentConductorService)
Parameters :
Name Type Optional
vcRef ViewContainerRef no
ccService ContentConductorService no

Inputs

dvk-content-container

The string used to refer to this container.

Type: string

Accessors

viewContainer
getviewContainer()

The ViewContainerRef of this directive.

import { Directive, ViewContainerRef, Input } from '@angular/core';
import { ContentConductorService } from '../content-conductor.service';
import { ContentContainer } from './content-container.model';

/**
 * A directive that can be attached to create a container 
 * where content with an attached {@link ContentDirective}
 * can be displayed.
 * 
 * The string set to the directive name is used to refer to
 * this container by the {@link ContentConductor}.
 * 
 * @example
 * <div dvk-content-container="my-container"></div>
 */
@Directive({
  selector: '[dvk-content-container]'
})
export class ContentContainerDirective implements ContentContainer {

  /**
   * The string used to refer to this container.
   */
  @Input('dvk-content-container') containerName: string;

  /**
   * The ViewContainerRef of this directive.
   */
  get viewContainer() { return this.vcRef; }

  constructor(
    private vcRef: ViewContainerRef,
    private ccService: ContentConductorService) {}
}



results matching ""

    No results matching ""