File

projects/dvk/src/lib/content-conductor/content-conductor.service.ts

Description

This service can be injected into a component in order to create a ContentConductor.

See ContentConductor for the details.

Example of usage:

../examples/index.html#/ContentConductor

Example

constructor(private conductorService: ContentConductorService) {}

Index

Methods

Constructor

constructor(conductorConstructor: ContentConductorConstructor)
Parameters :
Name Type Optional
conductorConstructor ContentConductorConstructor no

Methods

createContentConductor
createContentConductor(containersQueryList: QueryList | QueryList[], contentsQueryList: QueryList | QueryList[])
Type parameters :
  • T
  • U

Create a ContentConductor for moving content around a component's template.

Parameters :
Name Type Optional Description
containersQueryList QueryList<T> | QueryList<T>[] no

A QueryList or array of QueryLists of ContentContainers or directives extending ContentContainer.

contentsQueryList QueryList<U> | QueryList<U>[] no

A QueryList or array of QueryLists of Content directives or directives extending Content.

Returns : any

The ContentConductor

import { Injectable, QueryList, Inject } from '@angular/core';
import { ContentContainer } from './content-container/content-container.model';
import { ContentConductorConstructorToken } from './content-conductor-constructor/content-conductor-constructor.token';
import { ContentConductorConstructor } from './content-conductor-constructor/content-conductor-constructor.model';
import { Content } from './content/content.model';

/*
 * Even though this import is not used it is required for typescript
 * to resolve the return type of the createContentConductor method.
 * If it is removed this service will not compile correctly.
 */
import { ContentConductor } from './content-conductor.model';

/**
 * This service can be injected into a component in order to
 * create a {@link ContentConductor}.
 * 
 * See {@link ContentConductor} for the details.
 * 
 *  
 * Example of usage:
 * <example-url>../examples/index.html#/ContentConductor</example-url>
 *
 * 
 * @example
 * constructor(private conductorService: ContentConductorService) {}
 */
@Injectable()
export class ContentConductorService {
 
  constructor(
    @Inject(ContentConductorConstructorToken) 
    private conductorConstructor: ContentConductorConstructor) { }

  /**
   * Create a {@link ContentConductor}
   * for moving content around a component's template.
   * @param containersQueryList A QueryList or array of QueryLists of 
   * ContentContainers or directives extending ContentContainer.
   * @param contentsQueryList A QueryList or array of QueryLists of Content 
   * directives or directives extending Content.
   * @return The ContentConductor
   */
  createContentConductor<T extends ContentContainer, U extends Content>(
    containersQueryList: QueryList<T> | QueryList<T>[],
    contentsQueryList : QueryList<U> | QueryList<U>[]) {
    
    return  new this.conductorConstructor(
      containersQueryList,
      contentsQueryList
    );
  }
}

results matching ""

    No results matching ""