Angular7:模板解析错误:找不到管道"titlecase"/"slice" [英] Angular7: Template parse errors: The pipe 'titlecase' / 'slice' could not be found

查看:86
本文介绍了Angular7:模板解析错误:找不到管道"titlecase"/"slice"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将我的应用程序从 Angular 6 迁移到 Angular 7

I'm migrating my app from Angular 6 to Angular 7

运行ng update并更新我的软件包后,一切顺利,直到我运行:

After running ng update , and updating my packages , things goes well until i run:

ng build --configuration=production 

似乎找不到一些有角度的知名管道: titlecase / slice :

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">&nbsp;</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">&nbsp;</span>
    <span class="text-capitalize">{{[ERROR ->]userlastname | slice:0:1}} </span>
    <span class="text-capitalize">&nbsp;</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">&nbsp;</span>
    <span class="text-capitalize">{{userlastname | slice:0:1}} </span>
    <span class="text-capitalize">&nbsp;</span>
    <span>-</span>
    <span class="text-capitalize">&nbsp;</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>

因此,我已经验证了模块 NgModule ,并且很好地导入了 CommonModule

Thefore i ve verified my module NgModule , and i'm well importing the CommonModule

但是在构建应用程序时,它们会丢失

But when when building the app , they are missing

建议?

推荐答案

我遇到了完全相同的问题.经过一番挖掘,我发现它与在您的计算机中启用Ivy 有关TS配置.

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.

我要解决的问题是tsconfig.json删除以下配置:

What I did to solve it is remove the following configuration from the tsconfig.json:

"angularCompilerOptions": {
    "enableIvy": true
}

这篇关于Angular7:模板解析错误:找不到管道"titlecase"/"slice"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆