2014-11-06 196 views
1

我設置了一個AngularDart/PolymerDart項目,但我一直對以下錯誤運行:Module.DEFAULT_REFLECTOR未初始化

Breaking on exception: Module.DEFAULT_REFLECTOR not initialized for dependency injection. http://goo.gl/XFXx9G 

現在,我已經在讀的結尾給出的URL後面的頁面錯誤,並做了一些Stackoverflowing,但我遇到的唯一的溶劑是在pubspect.yaml中添加 - 作爲變換器的角色。所以我做到了。但是我仍然得到相同的錯誤,我的項目無法啓動。

我pubspec.yaml:

name: application 
description: application 
dependencies: 
    angular: '>=1.0.0 <2.0.0' 
    angular_node_bind: any 
    core_elements: '>=0.3.2 <0.5.0' 
    paper_elements: '>=0.5.0 <0.6.0' 
    polymer: '>=0.14.0 <0.16.0' 
    web_components: '>=0.9.0 <0.10.0' 
dependency_overrides: 
    args: '>=0.10.0 <0.12.0' 
    code_transformers: '>=0.1.4+2 <0.3.0' 
    html5lib: '>=0.10.0 <0.13.0' 
    observe: '>=0.11.0 <0.13.0' 
transformers: 
- angular 
- polymer: 
    entry_points: 
    - client/web/index.html 

的index.html:

<!DOCTYPE html> 
<html> 
    <head> 
    <meta charset="utf-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <title>Application</title> 

    <!-- include the web_components polyfills with support for Dart. --> 
    <script src="../packages/web_components/platform.js"></script> 

    <!-- imports --> 
    <link rel="import" href="../packages/polymer/polymer.html"> 
    <link rel="import" href="components/component.html"> 

    </head> 
    <body> 

    <!-- 
     don't put ng-app on html or body. the polymer build inlines 
     custom elements definitions, which can trigger bugs if the code 
     inlined is inside of ng-app 
    --> 
    <div ng-app>  
     <section> 
     <p>Angular</p> 
     <p> 
      <input type="text" ng-model="cool"> Angular binding: {{cool}} 
     </p> 
     </section> 

     <section> 
     <p>Polymer</p> 
     <my-element message="[[ cool ]]"></my-element> 
     </section> 
    </div> 

    <!-- initialize --> 
    <script type="application/dart" src='dart/init.dart'></script> 
    <script src="../packages/browser/dart.js"></script> 

    </body> 
</html> 

init.dart:

import 'package:polymer/polymer.dart'; 
import 'package:angular/application_factory.dart'; 
import 'package:angular_node_bind/angular_node_bind.dart' show NodeBindModule; 

void main() { 
    initPolymer() 
    .run(() { 
    applicationFactory() 
     .addModule(new NodeBindModule()) 
     .run(); 
    }); 

} 
+0

你的主要方法和index.html是怎麼樣的? – 2014-11-06 17:24:07

+0

我已更新我的帖子,幷包含這些代碼塊 – Dani 2014-11-06 17:55:31

+0

您是否嘗試過更改'pubspec.yaml'中變形金剛的順序? – 2014-11-06 18:02:45

回答

1

看來, 「網絡」 文件夾MUST與您的pu位於同一個文件夾中bspec.yaml。我把網頁文件夾放在一個文件夾「客戶端」中,導致了問題。將Web文件夾放在項目根文件夾中再次解決了問題。

+0

是的,像'web','lib','bin','example','tool'這樣的文件夾和其他我忘記的文件夾必須是你的包中的頂級文件夾('pubspec.yaml'的位置。這是沒有辦法的 – 2014-11-06 21:56:57

+0

啊哈,我沒有得到那份備忘錄,感謝您的指導! – Dani 2014-11-06 22:26:44