How can run a method $scope.myWork() after render template? I want to set the $scope.value and after that I need to change something with JQuery (e
I use terminal and transclude in a attribute directive to call a scoped method after a model is updated and view is rendered (in my case to resize a iframe after a $Resource.query):
.directive('postRender', [ '$timeout', function($timeout) {
var def = {
restrict : 'A',
terminal : true,
transclude : true,
link : function(scope, element, attrs) {
$timeout(scope.resize, 0); //Calling a scoped method
}
};
return def;
}])
The $timeout is black magic. It should be possible to declare the JS method as the attribute value and $parse it.
So I use it in a ng-repeat (in my case a tree is rendered recursively):