【发布时间】:2014-11-13 11:48:35
【问题描述】:
在我的表单正文中,我有这个(示例):
<div class="a" ng-repeat="q in question">{{q.Type}}</div>
结果将是:.
<div class="a ng-scope" ng-repeat="q in question">2</div>
question 包含用户的问题,以及消息类型中的 Type,如“System”、“Modules”等。
所以值是:
1:系统,
2:模块,
3: ...
这里是主题问题:
我想将 Type 更改为 image 。意思是我想用 tag 替换 {{q.Type}} 中的类型。所以我尝试使用过滤器并将我的代码更改为:
<div class="a" ng-repeat="q in question">{{q.Type | imgReplace}}</div>
我写了我的过滤器,然后在过滤器中我有这样的东西:
if (input == 2) {
return "<img src='img.jpg' />";
但结果是:
<div class="a ng-scope" ng-repeat="q in question"><img src="modules.jpg" /></div>
这种情况我能做些什么。它不呈现 html 标签并呈现纯文本。
谢谢。
【问题讨论】: