My intention is to use one pipe (LanguagePipe) from another pipe (DynamicPipe):
import { Pipe, PipeTransform } from '@angular/core';
import { LanguagePipe } from "./language.pipe"
@Pipe({
name: 'dynamic'
})
export class DynamicPipe implements PipeTransform {
public constructor(private language: LanguagePipe) { }
transform(value: any, pipeName: any): any {
.....
return this.language.transform(value);
}
}
This worked well. What I want to do is to make it custom so I can use another pipe without importing and declaring it.
...
public constructor(private injector: Injector) { }
transform(value: any, pipeName: any): any {
.....
//I tried to use the same pipe (language) for testing.
let pipe = this.injector.get("language");
return pipe.transform(value);
}
...
But then I get this error:
Here is my reference Dynamic pipe in Angular 2