Is there anyway how can I switch iron-pages programmatically in Polymer? My point is I want to redirect page when action is done in Polymer.
I know, I can redirect by using window.location.href
but need to know switch iron-pages in polymer programmatically.
_responseChanged: function(response) {
console.log('response', response.applicationId);
/*
I want to redirect page here
*/
},
Below are three ways in which you can do that
selectNext
function which will always select next page select
function and pass the page number that you want to be selected selected
property of iron-pages(not covered below) <base href="https://polygit.org/components/"> <link rel="import" href="polymer/polymer.html"> <link rel="import" href="iron-pages/iron-pages.html"> <dom-module id="iron-page-select"> <template> <style></style> <iron-pages id="pages" selected="0"> <div on-tap="_selectNext">tap me to change to next page</div> <div on-tap="_selectCustom">tap me to change to 4th page</div> <div>three</div> <div>four</div> </iron-pages> </template> </dom-module> <script> Polymer({ is: 'iron-page-select', _selectNext: function() { this.$.pages.selectNext(); }, _selectCustom: function() { this.$.pages.select(3); } }) </script> <iron-page-select></iron-page-select>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.