0

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.

1
  • Typo? missing function keyword. Commented Jan 3, 2015 at 21:09

1 Answer 1

1

I think you are missing word Function

$scope.fieldChanged = function (field, newValue) {
alert('fieldChanged called');

}

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.