简体   繁体   English

jQuery确认打字稿中没有功能

[英]Jquery Confirm not funtion in typescript

I know this has been asked before but I can't seem to find the answer, my jquery confirm not funtion, this problem in datatable with languange typescript angular 2, loadscript script have been declaration. 我知道这已经被问过了,但是我似乎找不到答案,我的jquery确认不起作用,在带有languange打字稿Angular 2的数据表中的这个问题,已经声明了loadscript脚本。

在此处输入图片说明

rows: {
  afterTemplate: function(row, data, index) {
    $('#delete-confirmation-dialog-' + data._id).on('click', function() {
      $.confirm({
        title: 'Delete?',
        content: 'Are you sure?',
        icon: 'fa fa-question-circle',
        animation: 'scale',
        closeAnimation: 'scale',
        opacity: 0.5,
        buttons: {
          'confirm': {
            text: 'Delete',
            btnClass: 'btn-red',
            action: function() {
              $.confirm({
                content: function() {

                  this.setTitle('Result');
                  this.setContent('Process...');

                  return $.ajax({
                    url: Urlapi + '/event/remove/' + data._id,
                    // headers: _self.jwt(),
                    dataType: 'json',
                    method: 'patch'
                  }).done(function(response) {
                    this.setContentAppend('<div>Done!</div>');
                    ( < any > $('.m_eventdatatable')).mDatatable('reload');
                  }).fail(function() {
                    this.setContentAppend('<div>Fail!</div>');
                  });
                },
              });
            }
          },
          cancel: function() {
            $.alert('Record canceled to delete');
          },
        }
      });
    });
  },
},

I'm new and not authorized for comments yet that's why didn't provide answer in comments. 我是新手,没有获得发表评论的权限,这就是为什么未在评论中提供答案。
Now lets move towards your problem i think you made a slightly mistake. 现在让我们解决您的问题,我认为您犯了一个小错误。


1)Adding jquery.js reference after jquery-confirm.js 1)在jquery-confirm.js之后添加jquery.js参考

Incorrect Way: 错误方式:

<script src="jquery-confirm-3.3.0.min.js"></script>
<script src="jquery.min.js"></script>

Correct Way: 正确方法:

<script src="jquery.min.js"></script>
<script src="jquery-confirm-3.3.0.min.js"></script>

OR 要么
2)Spell mistake of filename or path. 2)文件名或路径的拼写错误。


If anything else please share your example source code... Thanks :) 如果还有其他问题,请分享您的示例源代码...谢谢:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM