Using iron-pages and app-router to navigate to a new page, I encountered an issue with passing parameters to the iron-ajax element for making a request. The parameter {{parameter.identifier}} does not seem to work as expected in iron-ajax.
I believe this could be related to the local nature of routing parameters and how iron-ajax interacts with them. I've attempted adding a property for the param and implementing a getter function, but so far nothing has resolved the issue...
Moreover, the ajax functionality appears to be correct as substituting the binding variable {{parameter.identifier}} with a database value yields the desired result in queries.
<dom-module id="cst-data">
<template>
<style>
</style>
<triplat-route name="dataRoute" params="{{parameters}}"></triplat-route>
<iron-ajax
id="getData"
auto
url="http:/.../oslc/os/OSLCPERSON?"
params='{"oslc.where":"dcterms:identifier={{parameters.identifier}}"
}'
headers='{"Content-Type": "application/json;charset=utf-8"'
handle-as="json"
on-response="handleResponse"
></iron-ajax>
<paper-card>{{parameters.identifier}}</paper-card>
<paper-card>{{dataRes.name}}</paper-card>
</template>
</dom-module>
<script>
Polymer({
is: "cst-data" ,
handleResponse: function () {
this.dataRes = this.$.getData.lastResponse['rdfs:member'];
}
});
</script>