In the following code sample, accordion directive ensures that angular finishes first and then allow the JQueryUI to render the accordion with provided values in tags. But it's not working as expected. I'm following this link.
<div accordion>
<h3 ng-repeat-start="user in users" >
<a href="#">{{user.name}}</a>
</h3>
<div ng-repeat-end>
Name: {{user.name}}<br>
Type: {{user.type}}<br>
</div>
</div>
The following is the accordion directive implementation`
app.directive('accordion', function ($timeout) {
return {
restrict: 'A',
link: function ($scope, $element, attrs) {
$(document).ready(function () {
$scope.$watch('users', function () {
if ($scope.users != null) {
$timeout(function(){
$element.accordion();
});
}
});
});
}
};
});
JS Fiddle https://jsfiddle.net/7028yLdh/1/