- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我对 xeditable 指令有疑问。 onbeforesave 没有触发,即使就地编辑在客户端运行良好。我无法从 onbeforesave 或 onaftersave 得到任何反应。
我在我的项目中包含了 Angular 版本 1.5.0。我正在这样设置元素,它在表格中:
<tr ng-repeat="job in jobs">
<td>{{ job._id }}<i ng-click="removeJob(job._id)" class="fa fa-trash-o" aria-hidden="true"></i></td>
<td>{{ job.title }}</td>
<td editable-text="job.description" onbeforesave="alert('hello');">{{ job.description || "empty" }}</td>
</tr>
但是我无法在单击保存时关闭警报。
最佳答案
如果你看the documentation :
One way to submit data on server is to define
onbeforesave
attribute pointing to some method of scope
onbeforesave
接受一个范围方法,所以 alert('hello')
在这种情况下试图调用一些 $scope.alert
不存在的方法。为了使这项工作尝试类似的东西
// in your controller
$scope.test = function(data) {
alert(data);
};
// in your template
<tr ng-repeat="job in jobs">
<td>{{ job._id }}<i ng-click="removeJob(job._id)" class="fa fa-trash-o" aria-hidden="true"></i></td>
<td>{{ job.title }}</td>
<td editable-text="job.description" onbeforesave="test($data)">{{ job.description || "empty" }}</td>
</tr>
关于javascript - xeditable onbeforesave 不触发,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36851730/
我正在尝试检查我要保留的对象是否已经有一个“所有者”,如果没有,我将设置登录用户。此 EventListener 适用于 Contact 的任何其他字段,并且在我调试时它确实设置了用户。 MongoR
我对 xeditable 指令有疑问。 onbeforesave 没有触发,即使就地编辑在客户端运行良好。我无法从 onbeforesave 或 onaftersave 得到任何反应。 我在我的项目中
我正在尝试将验证逻辑添加到我们使用的消息格式值的编辑中。我创建了 plunker here来展示问题。这是花括号验证的代码。 vm.formatCheck = function (resource)
当第一次在我的应用程序中使用 Angular-Xeditable 时,我遇到了一个问题,试图找出如何将 x 可编辑的更改保存到通过 ng-repeat 循环访问的对象。 该文档主要侧重于使用 onbe
我是一名优秀的程序员,十分优秀!