我想寫一個指令jquery easy pie charts。jQuery的插件easyPieChart指令angularJS
繼教程,這是到目前爲止我的代碼..
angular.module('ysf.easyPieChart', []).directive('easyPieChart', function() {
return {
restrict: 'C',
scope: {
percent: '='
},
link: function(scope, elem, attrs) {
support._debug(elem.easyPieChart, 'element value');
support._debug(scope.percent, 'scope value');
//support._debug(this, 'this');
$(elem.easyPieChart).easyPieChart();
}
}
});
這該是多麼我從我的模板調用它
<div class='easyPieChart' percent='73'>73</div>
1.it並畫了一個圈,但它不是它應該在的地方。 2.它不填滿我適量的百分比。
鉻控制檯給我這個錯誤。
TypeError: Cannot call method 'createDocumentFragment' of null
thnakyou。
你能創建一個jsfiddle嗎? – zsong
其實我解決了問題 – debuggerpk
很酷。然後寫一個答案並將其標記爲已解決。 – zsong