My code so far:
.directive('ngSpreadsheet', function () {
return {
restrict: 'EA',
scope: {
curpart: '='
},
template: '<div id="dataTable" class="dataTable"></div>',
controller: SpreadsheetController,
link: function (scope, element, attrs) {
scope.$watch('curpart', function (val) {
console.log('curpart value changed, new value is: ' + val);
// here i want to call a function of the SpreadsheetController
// or is there a better way, executing stuff when an attribute changed?
});
}
}
})
var SpreadsheetController = (function () {
...
SpreadsheetController.prototype.curPartChanged = function () {
console.debug('curPartChanged');
};
})();