我正在将 JQuery xeditable 与 Angular2 一起使用,如下所示。但是,xeditable 弹出窗口仅打开一次。
有人可以帮我解决这个问题吗?
代码片段如下 组件类:
@Component({
//some code here..
})
export class ClientDetailsComponent {
ngOnInIt() {
$.fn.editable.defaults.mode = 'popup';
$.fn.editable.defaults.emptytext = '';
$('#comments').editable({
'rows ':4,
'inputclass':'word-wrap newComments',
onblur:'cancel'
});
}
public showpCommentBox() {
$('#comments').editable('show');
}
}
HTML 代码:
<a class="comments vertical-top word-wrap"
id="comments" data-type="textarea"
data-pk="1" data-url=""
(click)="showpCommentBox()"
data-title="Enter comments">
<i class="pe-7s-pen fa-1x text-primary text-left" title="Click to enter comments">
</a>
最佳答案
有“contenteditable”属性<h1 contenteditable="true">Something</h1>
你可以尝试它作为替代...
关于JQuery Xeditable 不适用于 Angular2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36788007/