Angularjs - X-可编辑:onAfterSave 中的 $data($data)
Angularjs - X-Editable: $data in onAfterSave($data)
$data 存储什么?它是否存储在我的 ng-options 中选择的对象?这是我的标记:
<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>
因为我的脚本有一个函数,它接收 $data 作为参数。这是我的示例代码:
$scope.save = function (data) { //data = $data
var savedRole = data; //data here is a JSON object
};
"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
$data 存储什么?它是否存储在我的 ng-options 中选择的对象?这是我的标记:
<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>
因为我的脚本有一个函数,它接收 $data 作为参数。这是我的示例代码:
$scope.save = function (data) { //data = $data
var savedRole = data; //data here is a JSON object
};
"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