【问题标题】:Argument of type '{}[]' is not assignable to parameter of type 'string''{}[]' 类型的参数不可分配给'string' 类型的参数
【发布时间】:2020-07-31 08:19:50
【问题描述】:

我必须以大写形式显示给定字符串“angular”的第一个字母,并且只需要显示一个字符。因此,我使用了下面的 tilecase 并以角度切割管道,效果很好,但是当我进行生产构建时,它会抛出错误 Argument of type '{}[]' is not assignable to parameter of type 'string'(ng build --prod)

例如:

输入

app.component.ts: 名称 = '角';

app.component.html: {{name |slice:0:1|titlecase}}

输出: 一个

请帮我解决这个错误/更好地使用它的方法。

【问题讨论】:

    标签: typescript pipe angular7


    【解决方案1】:

    尝试.. {{ 名称 |大写 |slice:0:1 }}

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-10-02
      • 2019-11-02
      • 2020-06-19
      • 1970-01-01
      • 1970-01-01
      • 2021-10-06
      • 2020-04-15
      相关资源
      最近更新 更多