Giter VIP home page Giter VIP logo

Comments (9)

zoechi avatar zoechi commented on May 22, 2024

Have you tried wrapping it with allowInterop(...)? (import from package:js)

I assume you need to do this in Dart code (not in the template).
This seems to be caused by the change from dart:js to package:js

from angular.

hentoesch avatar hentoesch commented on May 22, 2024

i tried the following:

in dart code:
get getContextMenuItems => allowInterop(addressBookData.getContextMenuItems);

in html:
<data-list
...
[contextMenuItems]="getContextMenuItems"
...

which does not provoke the original exception.
but when i call the closure in my polymer element i get the following exception:

Class 'JsFunction' has no instance method 'call'.

NoSuchMethodError: method not found: 'call'
Receiver: Instance of 'JsFunction'
Arguments: [_LinkedHashMap len:20]
#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2      DataList._showMenu (package:direkt_web/widgets/polymer/data_list.dart:300:54)
#3      DataList.selectionHandler (package:direkt_web/widgets/polymer/data_list.dart:281:9)
#4      Function._apply (dart:core-patch/function_patch.dart:7)
#5      Function.apply (dart:core-patch/function_patch.dart:28)
#6      _InstanceMirrorImpl.invoke (package:reflectable/src/reflectable_transformer_based.dart:259:21)
#7      addDeclarationToPrototype.<anonymous closure> (package:polymer/src/common/declarations.dart:134:35)

from angular.

matanlurey avatar matanlurey commented on May 22, 2024

Does this happen in dart2js, Dartium, or both?

from angular.

hentoesch avatar hentoesch commented on May 22, 2024

this one only happens in dartium.

from angular.

matanlurey avatar matanlurey commented on May 22, 2024

@jacob314 I think I saw this problem also when I was working on https://github.com/matanlurey/js-interop-examples (https://github.com/matanlurey/js-interop-examples/blob/master/web/vscode_example.dart#L10). Any insight?

from angular.

zoechi avatar zoechi commented on May 22, 2024

@hentoesch can you please fix the code formatting in your comments (wrap code in triple backticks)
Currently all line numbers are treated as references to other issues that also show up as back-reference to this issue there.

from angular.

hentoesch avatar hentoesch commented on May 22, 2024

finally found some time to track down the problem, which still persists in beta 21.
it is working now in dartium, but in chrome after darts2js it still does not work.

dart 1.19, ubuntu 16.04, chrome 53

i have the following constellation:

  • from angular i pass a dart object "model" to my polymer element
class Model {
  @reflectable
  Function callback;
  @reflectable
  String param;

}
  • in my polymer html markup i call a function which gets this object as a parameter
<div>{{callModel(model)}}</div>

which looks like:

@reflectable
callModel(model) {
  model.callback(model.param); 
}
  • after angular 21 the callModel() function gets called, but the parameter "model" in chrome is a JsObject - which does not know anything about a callback.

i built a litlle project to reproduce this bug:

https://github.com/hentoesch/angular_hates_polymer

any ideas?

from angular.

matanlurey avatar matanlurey commented on May 22, 2024

@jacob314 Are we missing something trivial?

from angular.

matanlurey avatar matanlurey commented on May 22, 2024

Closing since we haven't gotten any feedback since September.

from angular.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.