[英]angular js peity is not working with ng-repeat
為了創建一個簡單的餅圖,我正在使用虔誠 。 這非常簡單。 和js一起工作正常。
HTML
<span class='pie' data-peity='{ "fill": ["#1ab394", "#d7d7d7", "#ffffff"]}'>0.52/1.561</span>
並要求js--
$(".pie").peity("pie");
多數民眾贊成它..工作得很好,但問題是在角度js ng-repeat內。
<div ng-repeat='item in data'>
<span class='pie' data-peity='{ "fill": ["#1ab394", "#d7d7d7", "#ffffff"]}'>{{item.start}}/{{item.end}}</span>
</div>
但那不起作用。
所以我覺得我可能需要一個指令......所以我做了..
app.directive('pieChart', function ($timeout) {
return {
restrict: 'A',
link: function (scope, element) {
$timeout(function () {
element.peity("pie")
}, 100);
}
};
});
和html ===>
<td><span data-peity='{ "fill": ["#1ab394", "#d7d7d7", "#ffffff"]}' pieChart>0.52/1.561</span></td>
without ng-repeat
但那也不適合我。 我不知道為什么。任何人都可以幫助我......
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.