1
votes

I'm building an app with Angular Dart. When I'm trying to run it as a javascript it throws an error in the console (Firefox):

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

or for the same issue in Chrome:

NoSuchMethodError: undefined is not a function

In DevTools I figured that this error is thrown when the app is trying to download component's html file. Error is caused by precompiled javascript code:

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

I've checked properties of "config" variable and there is no "get$data" function. I'm not sure how to proceed. I've tried pub upgrade and error still exists. There's no error while I'm developing the app in Dartium and there everything works just fine.

Cheers.

1
What Angular.dart version are you using? If you import 'shadow_dom.js' in your entry page you should change it to 'web_components.js' github.com/angular/angular.dart/pull/972 - Günter Zöchbauer
Angular: 0.11.0, Dart: 1.4.0, web_components: 0.3.4. Nothing changed and still have the same issue. - Pawel Psztyc
I've removed all components from html. Then I noticed that the error i caused by <ng-view>. If I remove it everything works fine. Except for the view :) - Pawel Psztyc
You can take a look at this github.com/angular/angular.dart/issues/802 but otherwise I'm out of ideas. - Günter Zöchbauer
What about CSP? Is it can have anything to do with it? This is a Chrome App. However right now it is not using Chrome API. However I have "chrome" transformer in pubspec.yaml. I have the same error even when I remove it. But I use ng-csp directive for Angular. - Pawel Psztyc

1 Answers

1
votes

I've exactly the same error. I believe it's a bug in dart2js, along the lines of:

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

What puzzles me is that theoretically it should be resolved in 1.4.0, which I'm using, but it doesn't seem so.

You don't need to downgrade to angulardart 0.10.0. You can continue using 0.11 BUT you need to disable checked mode. This is a piece of my 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