I'm making a Polymer application that uses a iron-pages element containing three pages. The first two pages contains a paper-radio-group each and each paper-radio-button has a name value and a price value. The third page is supposed to display a list of with the name and price of the options i selected in the first and second page.
Here is the code for the element inside the first page:
<dom-module id="model-app">
<template>
<paper-radio-group class="layout vertical" id="modelgrp" selected="{{selected}}">
<template is="dom-repeat" items="{{models}}">
<paper-radio-button name="{{item.model}}"><span>{{item.model}}</span> <div class="paper-font-caption"><span>{{item.price}}</span> SEK</div></paper-radio-button>
</template>
</paper-radio-group>
<paper-item><span>{{selected}}</span></paper-item>
</template>
<script>
Polymer({
is: 'model-app',
ready: function() {
this.models = [
{model: 'Model1', price: '16 860'},
{model: 'Model2', price: '17 391'},
];
}
});
</script>
</dom-module>
The second page has an element that is basically identical expect for different options.
I have figured out that I can get the name of the selected item to display as you can see in the paper-item containing {{selected}}.
But I can't figure out how I can get that specific {{selected}} value inside another element. I've tried stuff like {{modelgrp.selected}} and {{modelgrp.$.selected}} but it doesn't display anything.
Also, the {{selected}} value is only for the name. How can I get the item.price value for the item that is selected?
Here is the code for the third page that isn't working properly:
<dom-module id="summary-app">
<template>
<paper-item>{{modelgrp.$.selected}}</paper-item>
<paper-item>test</paper-item>
</template>
<script>
Polymer({
is: 'summary-app',
ready: function() {
}
});
</script>
</dom-module>
itemas a property and then you can do two-way data binding across different pages. - Justin XL