How can I properly import the Pipe Module into my Angular app?
import { NgModule } from '@angular/core';
import { PipeTransform, Pipe } from '@angular/core';
@Pipe({ name: 'values', pure: false })
export class CustomPipe implements PipeTransform {
transform(value: any, args: any[] = null): any {
return Object.keys(value).map(key => value[key]);
}
static forRoot() {
return {
ngModule: CustomPipe,
providers: [],
};
}
}
This is my custom pipe module.
In my app.module.ts
imports: [
...,
CustomPipe.forRoot()
However, when I import it like this, I encounter the following error:
Unexpected value '[object Object]' imported by the module 'AppModule'