File

src/app/shared/widgets/container/widget-for.pipe.ts

Metadata

name widgetFor

Methods

transform
transform(component: string | any, configuration: any)
Parameters :
Name Type Optional
component string | any no
configuration any no
Returns : any
import { AppService } from "../configuration";
import { Optional, Pipe, PipeTransform } from "@angular/core";

@Pipe({
  name: "widgetFor",
})
export class WidgetForPipe implements PipeTransform {
  constructor(@Optional() private appService: AppService) {}

  transform(component: string | any, configuration: any): any {
    if (typeof component === "object") {
      return component;
    }

    if (this.appService) {
      return this.appService.toWidgetConfig(component);
    }

    return configuration._embedded[component];
  }
}

results matching ""

    No results matching ""