2017-08-09 41 views
0

我在ng-repeat中的元素中使用title属性时显示工具提示时出现问题。标题属性中的ng-repeat项目

<div ng-repeat="item in ctrl.items"> 
    <collapsable-panel is-open="true" class="custom-class" title="{{item.name}}"> 
     @* other code *@ 
    </collapsable-panel> 
</div> 

有了这个,我得到一个错误,

Syntax Error: Token '{' invalid key at column 2 of the expression [{{item.name}}] starting at [{item.name}}]. 

希望任何想法,为什么发生这种情况。

+0

尝试没有卷曲。 –

回答

1

您需要使用ng-attr来绑定标题。

试试这个:

<div ng-repeat="item in ctrl.items"> 
    <collapsable-panel is-open="true" class="custom-class" ng-attr-title="{{item.name}}"> 
     @* other code *@ 
    </collapsable-panel> 
</div>