I am trying to blend Polymer web components in my Angular application, but I am not being able to get the two-way data binding between these frameworks working. I've already watched this video and already tried the solution provided in this question but it still doesn't work for me. These were my attempts:
Objectattribute value<game-card game="{{game}}" bind-polymer></game-card>- based onpost-card.htmlon the Polymer tutorial.gameis an object with id, title, etc.I created the
gameChangedfunction on the web component and added a new property in thegamevariable, something likethis.game.foo = 'bar';, but if I do<pre><code>{{game | json}}</code></pre>right after the component, there's no
"foo": "bar"in the stringified object. Even withpublish: { game: {reflect: true} },it doesn't work.
Framework components
<core-input value="{{cool}}" bind-polymer></core-input> <paper-input value="{{cool}}" bind-polymer></paper-input>It only works if I edit the element's source code to
reflectthevalueattribute (oncore-input.html, as paper-input extends it). I think it isn't a good way of solving this issue.
Am I missing something? Is there a good resource I can look for this Angular-Polymer integration? Searching on Google brings more results about the material than about the library itself and, when found, most of them are "Polymer for Dart" resources.
reflect: truein order for this to work (github.com/Polymer/core-input/blob/master/core-input.html#L161). Otherwise, the attribute won't update and Angular's data binding system will never see a change. Maybe file a bug? github.com/Polymer/core-input/issues/new - ebidelObjecttype attribute? Isn't it supposed to add the new property to it, even more withreflect: true? Another issue I came over is that when I pass thegamevariable to the attribute, sometimes my web component receives a js Object and sometimes it receives a JSON string, forcing me toJSON.parseit. - danguilherme