问题
I'm migrating my app from Angular 6 to Angular 7
After running ng update , and updating my packages , things goes well until i run:
ng build --configuration=production
it seems that it can't find some angular well known pipes : titlecase / slice :
ERROR in : Template parse errors:
The pipe 'titlecase' could not be found ("span class="nav-item border-left text-truncate px-2 text-left">
<span class="text-capitalize">{{[ERROR ->]username | titlecase }}</span>
<span class="text-capitalize"> </span>
<span class="text-"): /media/khalidvm/SecondDisk/SOCLE_RCD/Front/Frontend_v3_crmd/src/app/Features/CRMD/navbar-crmd/navbar-crmd-components/navbar-crmd/navbar-crmd.component.html@14:36
The pipe 'slice' could not be found ("ecase }}</span>
<span class="text-capitalize"> </span>
<span class="text-capitalize">{{[ERROR ->]userlastname | slice:0:1}} </span>
<span class="text-capitalize"> </span>
<span>-</span>"): /media/khalidvm/SecondDisk/SOCLE_RCD/Front/Frontend_v3_crmd/src/app/Features/CRMD/navbar-crmd/navbar-crmd-components/navbar-crmd/navbar-crmd.component.html@16:36
My component looks like this :
<div id="HeaderNav" class="nav bg-white mx-auto py-1 d-flex flex-nowrap">
<span class="nav-item dropdown mx-1">
<a class="nav-link dropdown-toggle" data-toggle="dropdown" href="#" role="button" aria-haspopup="true" aria-expanded="false">
<span class="icon svg-avatar"></span>
</a>
<ul class="dropdown-menu">
<a class="dropdown-item disabled">Profil Conseiller</a>
<a class="dropdown-item" *ngIf="srcdPiloteViewAccess" (click)="goSrcdView()">Devenir Pilote</a>
<a class="dropdown-item" *ngIf="administrationViewAccess" (click)="goAdministrationView()">Devenir Administrateur</a>
<div class="dropdown-divider"></div>
<a class="dropdown-item" (click)="logout()">Se déconnecter</a>
</ul>
</span>
<span class="nav-item border-left text-truncate px-2 text-left">
<span class="text-capitalize">{{username | titlecase }}</span>
<span class="text-capitalize"> </span>
<span class="text-capitalize">{{userlastname | slice:0:1}} </span>
<span class="text-capitalize"> </span>
<span>-</span>
<span class="text-capitalize"> </span>
<span class="text-capitalize">boutique orange {{shopName}}</span>
</span>
<span class="nav-item text-truncate text-center en-attente">
<!--<span class="nav-item">4 personnes en attente</span>-->
</span>
<span class="espace-vide"></span>
</div>
Thefore i ve verified my module NgModule , and i'm well importing the CommonModule
But when when building the app , they are missing
Suggestions ?
回答1:
I had this exact same problem. With a little digging I found out it has something to do with having Ivy enabled in your TS config.
What I did to solve it is remove the following configuration from the tsconfig.json
:
"angularCompilerOptions": {
"enableIvy": true
}
来源:https://stackoverflow.com/questions/53430659/angular7-template-parse-errors-the-pipe-titlecase-slice-could-not-be-fou