简体   繁体   中英

Send data between Polymer Elements using iron-ajax

I'm having the my-app.html which does have the app-toolbar, app-drawerlayout and etc which is loading the my menu elements( myView1.html and myView2.html ).

I have iron-ajax call in myView1.html so when the response comes in the myView1.html it should navigate to myView2.html with response data came from the iron-ajax call

 // Function called when the response comes from iron-ajax
 function navigateToView2(data) {
        window.href = "/myView2";
 }

Please Help me, thanks in Advance

If you are doing a SPA (Single Page Application) and using the app-route element you will need to fire your own event from myView1.html to the my-app.html that contains the results of your ajax call. Then have the my-app.html change the app-route path to myView2.html. All while using data-binding to send the ajax response to the myView2.html. Events Up / Data Down! When using app-route the my-app.html file should control the changing of the SPA pages especially if you are needing to make sure to perform some kind of data-binding before loading the new page.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM