我在项目中使用angular-xeditable v0.9.0 lib。
我单击可编辑文本字段并显示可编辑表单。没关系。 但是当我点击任意位置后,可编辑的表单就会隐藏。我需要表单在单击后保持活动状态。 我怎样才能做到这一点?
html
<a
href
editable-text="item.desc"
class="has-text-weight-medium"
ng-if="auth.is('user')"
>
{{item.desc}}
</a>
js
app.controller('TestCtrl', function($scope) {
$scope.item = {
desc: 'desc'
};
});
我尝试创建指令和停止事件,但不起作用
app.directive('editableWithClickOutside', function($document) {
return {
link: function(scope, element) {
$document.on('mouseup', function(event) {
event.preventDefault();
event.stopPropagation();
});
}
}
});
我尝试使用 oncancel 属性,但在我的 customCancel 方法中事件字段未定义(
<a
href
editable-text="item.desc"
oncancel="customCancel($event)"
class="has-text-weight-medium"
ng-if="auth.is('user')"
>
{{item.desc}}
</a>
我这样解决了这个问题
app.run([
'editableOptions',
function (editableOptions) {
'use strict';
editableOptions.blurElem = 'ignore';
},
]);