How can I write Promise where the answer comes from iron-ajax.
<iron-ajax id="listItems" method="GET" content-type="application/json" handle-as="json" last-response="{{items}}" on-error="handleErrorResponse"></iron-ajax>
this.data = {
get: function(sort, page, pageSize) {
return new Promise(function(resolve, reject) {
// Execute iron-ajax.
//...
// resolve(iron-ajax response);
});
}
}
};
Run codeHide result
source
share