0
我想初始化一些jquery插件後,從$ http.get請求中加載數據的DOM。 請參見下面的代碼:
//this is get request code. I'm getting json data properly.
$http.get('reordering.json').success(function(data) {
$scope.words = data.data;
alert($("#sortable").html())
$("#sortable").sortable();
});
從下面的代碼<li>
正確生成,但我不能初始化jQuery插件,因爲alert()
它沒有顯示從JSON加載的數據。 setTimeout()
將工作,但我想知道哪個是正確的方法來做到這一點。
<ul id="sortable" class="dragContainer">
<li class="dragHolder" ng-repeat="word in words">
<div class="drag">{{word.value}}</div>
</li>
</ul>