src/app/shared/widgets/container/widget-for.pipe.ts
name | widgetFor |
transform | |||||||||
transform(component: string | any, configuration: any)
|
|||||||||
Parameters :
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];
}
}