I've got a simple rest service which provides a Route in my Ember app with some basic model data.
Here is my attempt to make it available:
model: function () {
var promise = new Em.RSVP.Promise (function (resolve, reject) {
var request = new XMLHttpRequest();
request.open("GET", "https://myStupidService/bla");
request.onreadystatechange = handler;
request.setRequestHeader("Accept", "application/json");
request.setRequestHeader("Authorization", authHeader);
request.send();
function handler () {
if (this.readyState === this.DONE) {
if (this.status === 200) {
resolve(this.response);
} else {
reject(this);
}
}
}
});
return promise;
}
When I mock the resolve method like this ...
// ...
if (this.status === 200) {
resolve({testProp: "RESOLVED"});
} else {
// ...
... testProp
can be rendered.
I also know that there are no errors in the template and that the promise _data prop contains everything needed when logged.
After several different, non-working variations (also tried jquery) I think its time for some insight.
Thanks in advance!