Search code examples
angularjsng-optionsx-editablemultiple-selectmultipleselection

Angularjs - X-Editable: $data in onAfterSave($data)


What does the $data stores? does it store the object selected in my ng-options? Here's my markup:

<span editable-select="item.myDropdown" e-multiple e-ng-options="rol as rol.roleName for rol in myCtrl.roles" onaftersave="showUsers.save($data)" ng-model="myRole.roleSelected"></span>

Because I have a function on my script where it receives the $data as parameter. Here's my sample code:

$scope.save = function (data) { //data = $data
    var savedRole = data;       //data here is a JSON object
};

Solution

  • "The Angular-Xeditable docs don't make it quite clear, but it appears that $data (and $index) are just injected values and that you can pass pretty much anything you want to the save/validate methods." -Michael Oryl