使用requirejs加载模块时,IE9会间歇性地出错 -

时间:2014-06-06 14:52:38

标签: angularjs requirejs

仅限IE9,休息所有浏览器都能正常工作。

它只是出错而出现以下错误 -   - 匿名的define()模块不匹配:function(){return q} http://requirejs.org/docs/errors.html#mismatch

以下是我的主要文件 -

require.config({
    baseUrl: '/tpservices/assets/scripts/',
    waitSeconds: 200,
  paths: {
    bootstrap              : 'bootstrap'
    ,app                   : 'app'
    ,routes                : 'routes'
    ,angular               : '../bower_components/angular/angular'
    ,angularRoute          : '../bower_components/angular-route/angular-route'
    ,angularCookies        : '../bower_components/angular-cookies/angular-cookies'
    ,angularSanitize       : '../bower_components/angular-sanitize/angular-sanitize'
    ,angularResource       : '../bower_components/angular-resource/angular-resource'
    ,angularMocks          : '../bower_components/angular-mocks/angular-mocks'
    ,angularFileUpload     : 'modules/angular_file_upload/angular-file-upload'
    ,angularFileUploadShim : 'modules/angular_file_upload/angular-file-upload-shim'
    ,text                  : '../bower_components/requirejs-text/text'
    ,jquery                : '../bower_components/jquery/dist/jquery'
    ,jqueryEventDrag       : '../bower_components/jquery.event.drag-drop/event.drag/jquery.event.drag'
    ,underscore            : '../bower_components/underscore/underscore'
    ,domReady              : '../bower_components/requirejs-domready/domReady'
    ,slickGridCore         : '../bower_components/slickgrid/slick.core'
    ,slickGrid             : '../bower_components/slickgrid/slick.grid'
    ,slickGridCheckBox     : '../bower_components/slickgrid/plugins/slick.checkboxselectcolumn'
    ,slickGridRowSelection : '../bower_components/slickgrid/plugins/slick.rowselectionmodel'
    ,ngDialog              : '../bower_components/ngDialog/js/ngDialog'
    ,ngGrid: '../bower_components/ngGrid/ng-grid-2.0.7'
    , jqueryui: '../bower_components/jquery-ui/ui/jquery-ui'

  },
  shim: {
    jquery                : {exports: '$'},
    angular               : {deps: ['jquery', 'underscore', 'angularFileUploadShim'], exports : 'angular'},
    angularRoute          : ['angular'],
    angularCookies        : ['angular'],
    angularSanitize       : ['angular'],
    angularResource       : ['angular'],
    angularFileUpload     : ['angular'],
    ngDialog              : ['angular'],
    ngGrid                : ['angular'],
    jqueryui              : {
        exports: "$",
        deps: ['jquery']
    },
    angularMocks          : {
      deps     :['angular'],
      'exports':'angular.mock'
    },
    jqueryEventDrag       : ['jquery'],
    slickGridCore         : ['jquery', 'jqueryEventDrag'],
    slickGrid             : ['slickGridCore'],
    slickGridCheckBox     : ['slickGridCore'],
    slickGridRowSelection : ['slickGridCore']
  },
  deps: ['bootstrap']
});

1 个答案:

答案 0 :(得分:0)

如果您正在混合AMD和非AMD模块,通常会出现此问题。

您是否使用Require加载所有JS文件?请务必使用Shim。

对Angular本身进行此操作