加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

angularjs – TypeError:i.match不是函数

发布时间:2020-12-17 17:06:34 所属栏目:安全 来源:网络整理
导读:我一直在研究drupal angularjs模块.我已经安装了bootstrap ui,工作正常.但是,当我使用模态框时,它不起作用. 控制器内的代码: $scope.alertOnEventClick = function( event,allDay,jsEvent,view ){ $scope.alertMessage = (event.title + ' was clicked ');
我一直在研究drupal angularjs模块.我已经安装了bootstrap ui,工作正常.但是,当我使用模态框时,它不起作用.

控制器内的代码:

$scope.alertOnEventClick = function( event,allDay,jsEvent,view ){
    $scope.alertMessage = (event.title + ' was clicked ');
    console.log($modal);

    var modalInstance = $modal.open({
        //templateUrl: Drupal.settings.angularjsApp.basePath + '/ng_node/calender/popup',template: "<div class='modal-header'><h3 class='modal-title'>I'm a modal!</h3>" +
            "</div><div class='modal-body'><ul><li>jfksdfhjksd</li><li>jfksdfhjksd</li><li>jfksdfhjksd</li></ul></div>"+
            "<div class='modal-footer'><button class='btn btn-primary'>OK</button>" +
            "<button class='btn btn-warning'>Cancel</button></div>",controller: ModalInstanceCtrl,scope: $scope
    });



    function ModalInstanceCtrl($scope,$modalInstance) {
     console.log("controller class called")
     };

我仍然面临着bootstrap ui popup模型的问题.

解决方法

I too faced this problem earlier. With further investigation I could
understand that as per angular guidelines,the isolated scope can only
have the attributes of the custom directives. It throws error if we try to create a new scope value which doesn’t matches with any of the attribute.

myModule.directive('directiveName',function factory() {
  return {
    ...
    scope: {
      'attrName': '@',// OK
      'attrName2': '=localName',// OK
      'attrName3': '<?localName',// OK
      'attrName4': ' = name',// OK
      'attrName5': 'name',// ERROR: missing mode @&=
      'attrName6': 'name=',// ERROR: must be prefixed with @&=
      'attrName7': '=name?',// ERROR: ? must come directly after the mode
    }
    ...
  }
});

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读