lowercase}}

问题描述 投票:0回答:2
. However, if I try to use it in an src attribute like this:

I get the error: core.js:...<h2>{{event.role | lowercase}}</h2>You need to use quotes around the expression, otherwise angular will not be able to parse your expressionsrcOr

<img src={{event.eventName | lowercase}} alt="">

core.js:6237 ERROR DOMException: 
Failed to execute 'setAttribute' on 'Element': '|' is not a valid attribute name.

{{event.eventName}}To use pipes with variables that are bound to properties, you could wrap it in a container with a

directive. It also allows you to apply the pipe once and reuse the modified variable multiple times. Try the following
angular angular-pipe
2个回答
2
投票

它不能识别管道,然而,不使用管道是正确的,所以格式为:

<img src="{{ event.eventName | lowercase }}" alt=""

缝隙工作。我应该怎么做?

<img [src]="event.eventName | lowercase" alt=""

3
投票

如果我这样做。*ngIf{{事件角色

© www.soinside.com 2019 - 2024. All rights reserved.