How to data bind in the new Polymer v1.0?
I saw an answer in polymer iron-ajax : How to Bind data from input element to iron-ajax's body attribute
But it did not help me and Here is my code
<dom-element id="test-app>
<template>
...
<iron-ajax
auto
url="https://www.googleapis.com/youtube/v3/search"
params="{{ajaxParams}}"
handleAs="json" lastResponse="{{response}}"
method='GET'>
</iron-ajax>
</template>
</dom-module>
Script
Polymer({
is:"Test-app",
properties: {
qry: {
type: String,
value: 'Cat'
},
key1: {
type: String,
value: 'myapikey'
},
part1: {
type: String,
value: 'snippet'
},
maxResults1: {
type: Number,
value: 10
},
ajaxParams: {
type: String,
computed: 'processParams(part1, qry, maxResults1, key1)'
}
},
processParams: function(part1, qry, maxResults1, key1){
var param = JSON.stringify({part: part1, q:qry, maxResults: maxResults1, key:key1});
console.log(param);
return param;
}
});
</script>
I get the correct log in console as a JSON string, but when this value is being returned, the value is taken literally (same problem as told in the link provided above) and not as its value.
I get an error in console as bad request code 400. Any help is highly appreciated.