Issue
My ajax is defined as:
<iron-ajax id="myAjaxId" auto
url="http://localhost:8088/test_server/v1/users/35"
handle-as="json"
on-response="{{handleResponse}}" ></iron-ajax>
and in my dart i say:
@reflectable
void handleResponse ( e, Map data ){
print("hand response fired");
f_name = data["f_name"];
l_name = data["l_name"];
id = data["id"];
}
not only does it not fire the print statement, but in the Chromium console, when it is run, it says:
[my-ajax-fetcher::_createEventHandler]: listener method `{{handleResponse}}` not defined
I was looking up some other examples and noticed @reflectable is the tag i should be applying.
I was also trying to look up what the target signature needs to look like, and didnt see anything.
Solution
You don’t need {{}}
for event handlers in Polymer 1.x just on-response="handleResponse"
Answered By – Günter Zöchbauer
Answer Checked By – Cary Denson (FlutterFixes Admin)