Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angularjs/21.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angularjs Can';t让ocLazyLoad与ES6一起工作(AMD模式下的Traceur和模块)_Angularjs_Lazy Loading_Amd_Traceur - Fatal编程技术网

Angularjs Can';t让ocLazyLoad与ES6一起工作(AMD模式下的Traceur和模块)

Angularjs Can';t让ocLazyLoad与ES6一起工作(AMD模式下的Traceur和模块),angularjs,lazy-loading,amd,traceur,Angularjs,Lazy Loading,Amd,Traceur,我有一个项目,我使用Traceur开发ES6格式的代码,并将模块加载设置为传输到AMD样式,以便使用RequireJS。我有以下代码(从ocLayLoad示例项目中获得) angular.module(“testApp”,[]).directive(“sayHello”,function()){ 返回{ 范围:{ 致:“@to” }, 限制:“E”, 模板:'你好{{{to}}' }; }); 如果我使用带有ocLazyLoad+RequireJS的纯ES5风格,那么一切都很好。但是,当Tra

我有一个项目,我使用Traceur开发ES6格式的代码,并将模块加载设置为传输到AMD样式,以便使用RequireJS。我有以下代码(从ocLayLoad示例项目中获得)

angular.module(“testApp”,[]).directive(“sayHello”,function()){
返回{
范围:{
致:“@to”
},
限制:“E”,
模板:'你好{{{to}}

' }; });
如果我使用带有ocLazyLoad+RequireJS的纯ES5风格,那么一切都很好。但是,当Traceur处理该类时,它被包装在define()函数中,如下所示:

define([], function() {
  "use strict";
  angular.module("testApp", []).directive("sayHello", function() {
    return {
      scope: {to: '@to'},
      restrict: "E",
      template: '<p>Hello {{to}}</p>'
    };
  });
  return {};
});
定义([],函数(){
“严格使用”;
angular.module(“testApp”,[])指令(“sayHello”,function()){
返回{
作用域:{to:'@to'},
限制:“E”,
模板:'你好{{{to}}

' }; }); 返回{}; });
但是,在这种情况下,由于某种原因,延迟加载不起作用。它抛出一个错误,模块“testApp”未在angular中注册。 知道是什么阻止了ocLazyLoad加载模块吗

define([], function() {
  "use strict";
  angular.module("testApp", []).directive("sayHello", function() {
    return {
      scope: {to: '@to'},
      restrict: "E",
      template: '<p>Hello {{to}}</p>'
    };
  });
  return {};
});