I am using xeditable within the directive. This is working fine. However, I am unable to get onbeforesave (and others) to work. Below is the outline of my angularjs code:
app.directive('view', function () {
return {
scope: { field: "=", onbeforesave: "&" },
restrict: 'E',
transclude: true,
replace: true,
template: '<a href="#" deditable-text="field" onbeforesave="onbeforesave(field, $data)">{{ field || "empty" }}</a>'
}
});
in index.html:
...
<view field="userObj" onbeforesave="fieldChanged()">
...
</view>
In my controller.js
...
$scope.userObj = "xyz";
$scope.fieldChanged = function (field, newValue) {
alert('fieldChanged called');
}
My problem is that $scope.fieldChanged() was never called. Could anyone point out what I am doing wrong?
Thanks.