JQuery Xeditable 不适用于 Angular2

标签 jquery angular x-editable

我正在将 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/

相关文章:

angularjs - 模型未在 Angular-Xeditable、Angular Ui-Select 中更新

angular - mat-table 以编程方式跳到特定行

angular - Angular 10 PWA 中 Chrome 更新后的新警告 "Site cannot be installed: Page does not work offline. Starting in Chrome 93..."

javascript - AngularJS 不解析从指令动态加载的数据

javascript - vanilla js 路由不起作用,仅显示 [object XMLDocument]

javascript - 如何在 Rails 中将 javascript/jQuery 设置从一个页面传递到另一个页面?

jquery - jQuery 中的 JSON 解析错误

Jquery数据表列过滤器标题响应式

javascript - 在 webworker 中运行 Angular 5 应用程序会导致窗口对象未定义

php - 使用 x-editable 将 URL 文本插入数据库