user5303752
user5303752

Reputation:

Ajax with polymer. render after response

I try to make ajax with polymer iron-ajax.

My problem is that when Is their is some elements that can be render only after I received response, otherwise their is not data to render.

How can I "stop" the render of the element until their is response?

Thanks

Upvotes: 0

Views: 368

Answers (2)

Francisco Santos
Francisco Santos

Reputation: 11

Just: <template is="dom-if" if="[[response]]">

Upvotes: 1

Ricky
Ricky

Reputation: 1009

Two options:

  1. Add a conditional hiddenattribute to the div or elements you want hidden before the ajax call is completed:

    <div hidden$="[[!response]]"></div>

    or handle visibility using a computed binding

    <div hidden$="[[_computeIsHidden(response)]]"

  2. Wrap your content in a dom-if template:

    <template is="dom-if" if="[[_computeIsHidden(response)]]">

Upvotes: 0

Related Questions