Hi there,
I've got the following scenario:
- I created two Polymer Elements, let's call them respectively "interpreter" and "viewer"
- Basically, the "interpreter" makes an AJAX request to get data with jQuery $.ajax(). When the request is completed, the interpreter processes the answer, and provides it to the "viewer".
- When the interpreter finishes to process the data, the "viewer" is registered (just once) and instantiated into the "interpreter" (it is appended to a div inside the "interpreter" template). The "viewer" gets the data from the "interpreter" as attribute directly in the declaration tag (like this: <polymer-viewer data="{json object}></polymer-viewer>).
When I declare just one instance of the "interpreter" I've got no problem to display correctly the "viewer".
Same result when I declare more than one instance of the "interpreter" with the same URL in the AJAX request.
I noticed that when I declare more than one instance of the "interpreter" (hence, when I want to display more than one "viewer") with different URLs in the AJAX request, only the first "interpreter" that receives a response from the AJAX request is able to render correctly the "viewer" (i.e. when the second instance gets the results, the results set is null, although in the declaration tag I can see the attribute with the dataset from the "interpreter").
It seems a synchronization problem between the AJAX request and the instantiation/rendering task.
In fact, serializing the AJAX requests (setting async = false) both the "viewer" can be rendered.
Any suggestions?
Thank you :)