我必须以大写字母显示给定字符串“ angular”的首个字母,并且也只需要显示一个字符。因此,我将下面的tilecase和slice管道使用成角形,效果很好,但是在我进行生产构建时Argument of type '{}[]' is not assignable to parameter of type 'string'
会抛出错误(ng build --prod)
例如:
输入
app.component.ts: name ='angular';
app.component.html: {{name | slice:0:1 | titlecase}}
输出: A
请帮助我解决此错误/更好地使用此方法。
答案 0 :(得分:0)
试试.. {{ 名字 | titlecase |slice:0:1 }}