问题
I'm trying to build my Angular 7 project but every time I get an error saying
ERROR in : Template parse errors:
The pipe 'currency' could not be found....
But when I try to run the ng serve
it does works as expected
I've tried to build it with the --prod
flag, and it doesn't work. If I remove the production flag, it build correctly.
回答1:
Try this:
in tsconfig.json
change
"angularCompilerOptions": {
"enableIvy": true
}
for
"angularCompilerOptions": {
"enableIvy": false
}
回答2:
In order to use pipes, you first need add pipe to your module declarations:
import {CurrencyPipeComponent} from './currencypipe.component';
@NgModule({
imports: ...,
declarations: [
...,
CurrencyPipeComponent],
})
export class YourModuleWhichYourComponentIsRegistered { }
来源:https://stackoverflow.com/questions/53503724/angular-7-doesnt-find-pipes