【发布时间】: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