requirejs中的ngReactGrid问题

时间:2014-07-23 06:53:46

标签: angularjs requirejs

尝试使用ngReactGrid我遇到了网格组件(ngReactGrid.js:38)引发错误错误的问题未定义。可能导致这种情况,因为requirejs设置文件包含

"shim": {
"angular": {
  exports: 'angular'
},
'react': {
  exports: 'React'
},
"ngReactGrid": {
  deps: ['angular', 'react']
}

}

http://plnkr.co/edit/MwxbGnx1xu3gxfhY7ENM

requirejs之外的相同代码可以正常工作。

1 个答案:

答案 0 :(得分:0)

结帐plnkr

    require.config({
      "baseUrl": "/js",
      "paths": {
        "angular": "https://code.angularjs.org/1.3.0-beta.5/angular",
        "react": "http://fb.me/react-0.10.0",
        "ngReactGrid": "https://rawgit.com/josebalius/ngReactGrid/master/build/js/ngReactGrid",

        'app': 'http://run.plnkr.co/zmcl7fFM2eAPf9Ew/app'
      },
      "shim": {
        "angular": {
          exports: 'angular'
        },
        "ngReactGrid": {
          deps: ['angular', 'react']
        }
      }
    });

    require(['app'], function( app) {

      var $html = angular.element(document.getElementsByTagName('html')[0]);

      angular.element().ready(function() {
        angular.bootstrap($html, [app.name]);
      });

});

希望这会有所帮助