【发布时间】:2018-04-25 23:30:01
【问题描述】:
我有这个字符串:
this.badge = `<span class="badge">{{ notification}}</span>`
解释我所做的 {{ notification}} 表达式:
this.badge = this.$interpolate(this.badge)(this)
我现在想做的是在span 元素中添加一个ng-if:
this.badge = `<span ng-if="notification > 0"class="badge">{{ notification}}</span>`
但是$interpolate 服务不支持这个,我如何“编译” ng-if 的条件?
【问题讨论】:
标签: javascript angularjs angularjs-compile angularjs-interpolate