Two-way binding PolymerDart element to Angular.dart model

I managed to bind my Angular.dart model to two paper elements using the bind- syntax:

 <paper-input bind-value="item.name"></paper-input> 

Now I want to create a custom component that can set the property for two-way binding:

 @CustomTag('px-test') class PxTest extends PolymerElement { @published var data = 1; } 

used as:

 <px-test bind-data="item.data"></px-test> 

The component receives the visualization, and the data field specified in the component template with {{data}} is displayed correctly, but the data not item.data to item.data , i.e. if item.data is 55 the component still does 1. Angular also tries to create a binding, it creates a clock on item.data , but the changes do not apply to PxTest.data What do I need to change in PxTest to make the binding happen?

Versions: Angular: 1.0, Polymer: 0.15.1 + 3

+6
source share
1 answer

I don’t know the details of how the binding between Angular.dart and Polymer.dart works, but I suggest you try

 //@published @PublishedProperty(reflect: true) var data = 1; 

Thus, the DOM attribute is also updated.

+1
source

Source: https://habr.com/ru/post/977928/


All Articles