dart - pass Polymer data binding through a Javascript function -
I am using polymers and darts to create a list of point coordinates. It provides a list of digits in html. However, I want to convert points from one coordinate system to another by using the Javascript function.
In HTML darts-polymers:
& lt; Repeat template = "{{grid_points}}" & gt; & Lt; Core-item & gt; {{P}} & lt; / Core-item & gt; & Lt; / Template & gt;
I found a library in Javascript:
grid_to_godetic (x, y);
Grid_points is a list of numbers. How can I pass PX and PE through JS function and how do I get results given at the place of P in HTML Template?
You can use it for:
& lt; Repeat template = "{{grid_points}}" & gt; & Lt; Core-item & gt; {{P | Grid_to_godetic}} & lt; / Core-item & gt; & Lt; / Template & gt; ... & lt; Script & gt; Polymer ('your element', {grid_to_godetic: function (point)} {return point.x + point.y;}}); & Lt; / Script & gt;
The filter takes one and gives one, if you have to change the X and Y separately, then you have to use a continuous parameter, to indicate that the key You want to change the point, / P>
& lt; Repeat template = "{{grid_points}}" & gt; & Lt; Core-item & gt; {{P | Grid_to_godetic (1)}} & lt; / Core-item & gt; & Lt; Core-item & gt; {{P | Grid_to_godetic (2)}} & lt; / Core-item & gt; & Lt; / Template & gt; ... & lt; Script & gt; Polymer ('your element', {grid_to_godetic: function (point, part) {if (part == 1) return point.x; else return point.y;}}); & Lt; / Script & gt;
Comments
Post a Comment