I want to change the view in Polymer when I click on a specific tab. For this, I thought about using paper tabs and iron pages, as described in the paper-tabs documentation.
This is the HTML I have to understand:
<html> <head> <title>Test</title> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="bower_components/polymer/polymer.html"> <link rel="import" href="bower_components/paper-tabs/paper-tabs.html"> <link rel="import" href="bower_components/iron-pages/iron-pages.html"> </head> <body> <paper-tabs selected="{{selected}}"> <paper-tab>Tab 1</paper-tab> <paper-tab>Tab 2</paper-tab> <paper-tab>Tab 3</paper-tab> </paper-tabs> {{selected}} <iron-pages selected="{{selected}}"> <div>Page 1</div> <div>Page 2</div> <div>Page 3</div> </iron-pages> </body> </html>
Changing the tabs seems to work. But it seems that the selected variable is not set correctly, because the Iron Pages element does not change appearance. How can I achieve the required data binding in Polymer 1.0? Do I need to create a custom container element around two elements to provide them with an area in which both can access such a variable?
bmf source share