如何绑定在NG-表title属性值 [英] How to bind title attribute value in ng-table
问题描述
我使用的NG-表中显示在表视图中的所有值。要显示在备注栏(表的最后一栏)消息是巨大的。所以,我很少显示字符。当用户将鼠标悬停在单元格我要显示的工具提示整个邮件。我试图将其设置为title属性,但它不工作。
I am using ng-table to display all values in a table view. Message to be displayed in remarks column (last column of the table) is huge. So, I am displaying few character. When user hovers over the cells I want to show the entire message in a tool-tip. I tried to set it in title attribute, but it's not working.
样code: http://plnkr.co/edit/I4nCTNhMfxgbBX7Zjxs9 p = preVIEW
<table ng-table="tableParams" class="table">
<tr ng-repeat="doc in $data">
<td data-title="'#'" sortable="doc_name">{{$index + 1 }}</td>
<td data-title="'Visa Type'" sortable="'type'">{{doc.type}}</td>
<td data-title="'Country'" sortable="'country'">{{doc.country}}</td>
<td data-title="'Starting Date'" sortable="'start_date'">{{doc.start_date}}</td>
<td data-title="'Expired Date'" sortable="'end_date'">{{doc.end_date}}</td>
<td data-title="'Remarks'" sortable="'remarks'" title="{{doc.remarks}}">
{{doc.remarks | limitTo: 15 }} {{doc.remarks.length > 15 ? '...' : ''}}
</td>
</tr>
</table>
请建议我如何使用HTML title属性显示工具提示。
Please suggest me how to show tool-tip using HTML title attribute.
推荐答案
我认为你可以使用NG-ATTR标题为,所以basicly您的code仍然是相同的,只是之前称号='你加上'NG-attr-。所以,你的最后一行想这样的:&LT; TD数据标题='备注'排序='言论'NG-ATTR标题={{doc.remarks}}&GT;
I think you can use the ng-attr-title for that, so basicly your code remains the same, but just before 'title=' you add 'ng-attr-'. So your last line would like like: <td data-title="'Remarks'" sortable="'remarks'" ng-attr-title="{{doc.remarks}}">
我以前没有在表格单元测试这一点,但理论上应该做的伎俩: - )
I haven't tested this on table cells before, but theoretically it should do the trick :-)
更新
请参阅该工作plunkr: http://plnkr.co/edit/WHm04jGoiE3oZi244fqj? p = preVIEW
See this working plunkr: http://plnkr.co/edit/WHm04jGoiE3oZi244fqj?p=preview
正如你可以看到我做了NG-table.js地方,然后在index.html的我把NG-ATTR标题中的NG表的属性前面。
As you can see I made ng-table.js local, and then in index.html I put the ng-attr-title in front of the ng-table attributes.
这篇关于如何绑定在NG-表title属性值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!