You might need to pass a variable as a separate parameter:
app.directive('jQueryPluginDirective',['$timeout', function (timer) {
return {
restrict: 'A',
scope: {
data: "="
},
link: function(scope, element, attrs) {
var myFunctionToExecuteAfterDomMod = function(){
//element.myPluginJquery
}
scope.$watch('data', function(newVal, oldVal){
alert('data changed'); // probably want to use console.log() here instead
}
}
};
}]);
then your HTML would look like this:
<ul jQuery-plugin-directive data="changeAfterSuccess">
UPDATE:
Also, why don't you pass the data and generate html in your directive:
controller HTML:
<jQuery-plugin-directive change="{{changeAfterSuccess}}" data="varList"></jQuery-plugin-directive>
JS in directive
app.directive('jQueryPluginDirective',['$timeout', function (timer) {
return {
restrict: 'A',
scope: {
data: "=",
change: "="
},
template: "<ul>
<li ng-repeat="var in varList">
{{var.attr}}
</li>
</ul>", // concatenate these lines in to a string
link: function(scope, element, attrs) {
var myFunctionToExecuteAfterDomMod = function(){
//element.myPluginJquery
}
scope.$watch('data', function(newVal, oldVal){
alert('data changed'); // probably want to use console.log() here instead
}
}
};
}]);