2014-05-25 16 views
1

我正在用Angular Dart構建一個應用程序當我試圖將它作爲javascript運行時,它會引發錯誤在控制檯(火狐):

"NoSuchMethodError: Cannot call "get$data" (config.get$data is not a function)

或在Chrome同樣的問題:

NoSuchMethodError: undefined is not a function

在DevTools我想,當應用程序試圖下載組件的HTML文件引發此錯誤錯誤是由預編譯的JavaScript代碼引起的:

closure322: { 
    "^": "Closure:139;", 
    call$1: function(config) { 
    config.get$data(config); 
    config.get$data(config); 
    return config; 
    }, 
    $isFunction: true 
}, 

我已經檢查過「config」變量的屬性,並且沒有「get $ data」函數。 我不知道如何繼續。我試過pub升級,錯誤仍然存​​在。在Dartium開發應用程序時沒有錯誤,並且一切正常。

乾杯。

+0

你用什麼Angular.dart版本?如果您在條目頁面中導入'shadow_dom.js',則應將其更改爲'web_components.js' https://github.com/angular/angular.dart/pull/972 –

+0

Angular:0.11.0,Dart:1.4 .0,web_components:0.3.4。沒有任何改變,仍然有相同的問題。 –

+0

我已經從html中刪除了所有組件。然後我注意到由引起的錯誤。如果我刪除它一切正常。除了視圖:) –

回答

1

我有完全一樣的錯誤。我相信這是dart2js的錯誤,沿着線:

https://code.google.com/p/dart/issues/detail?id=18383

令我百思不解的是,理論上它應該在1.4.0得到解決,我使用它,但它似乎不那麼。

您不需要降級到angulardart 0.10.0。您可以繼續使用0.11,但您需要禁用選中的模式。這是我的一個pubspec.yaml:

transformers: 
    - angular: 
     html_files: 
     - web/view/home.tpl.html 
     - web/view/join.tpl.html 
     - web/view/lobby.tpl.html 
     - web/view/login.tpl.html 
    - $dart2js: 
     checked: false 
     minify: false 
     verbose: false 
     analyzeAll: false 
     suppressWarnings: false 
     suppressHints: false 
     terse: false 
+0

謝謝,它現在與0.11工作。 –