I want to initialize some jquery plugin after data is loaded in dom from $http.get request. See below code:
//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();
});
From below code <li>
is generating properly but I'm not able to initialize jquery plugin because in alert()
it is not showing data loaded from json. setTimeout()
will work but I want to know which is proper way to do this.
<ul id="sortable" class="dragContainer">
<li class="dragHolder" ng-repeat="word in words">
<div class="drag">{{word.value}}</div>
</li>
</ul>