I have a problem with Polymers iron-ajax element. When calling it like this:
<iron-ajax url="https://api.onedrive.com/v1.0/drive/root" params='{"access_token":"[[access_token]]"}'></iron-ajax>
It sends a url like this, splitting the whole params string into multiple parameters:
https://api.onedrive.com/v1.0/drive/root?0="&1=a&2=c&3=c&4=e&5=s&6=s&7=_&8=t&9=o&10=k&11=e&12=n&13="...
When using a normal String as parameter it works correctly so i guess the quotes are correct.
The script part of the Element which uses iron-ajax:
<script>
Polymer({
is: 'onedrive-files',
properties: {
access_token: String
},
ready: function() {
},
});
</script>
and i am calling the element like this:
<onedrive-files access_token="testtoken">
</onedrive-files>
Does anyone have any ideas? Thanks!
Edit: With an getter Function:
<dom-module id="onedrive-files">
<template>
<iron-ajax id="ajax" url="https://api.onedrive.com/v1.0/drive/root" last-response="{{data}}" params='{{_getParams()}}' auto></iron-ajax>
</template>
<script>
Polymer({
is: 'onedrive-files',
properties: {
access_token: String
},
_getParams: function()
{
return ('{"access_token":"' + this.access_token + '"}');
},
ready: function() {
this.$.ajax.generateRequest();
},
});
</script>
</dom-module>
With setting the Param in the Ready function:
<dom-module id="onedrive-files">
<template>
<iron-ajax id="ajax" url="https://api.onedrive.com/v1.0/drive/root" last-response="{{data}}" auto></iron-ajax>
</template>
<script>
Polymer({
is: 'onedrive-files',
properties: {
access_token: String
},
ready: function() {
this.$.ajax.params = '{"access_token":"' + this.access_token + '"}';
},
});
</script>
</dom-module>