polymer - Iron-ajax Data binding -
how data bind in new polymer v1.0?
i saw answer in polymer iron-ajax : how bind data input element iron-ajax's body attribute
but did not me , here 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 correct log in console json string, when value being returned, value taken literally (same problem told in link provided above) , not value.
i error in console bad request code 400. highly appreciated.
the property params of type object. unlike in linked example, can return native object.
processparams: function(part1, qry, maxresults1, key1) { return { part: part1, q: qry, maxresults: maxresults1, key:key1 }; }
Comments
Post a Comment