In a controller:
/*globals Ember*/
import { raw as icAjaxRaw } from 'ic-ajax';
...
myData: function() {
var promise = new Ember.RSVP.Promise(function (resolve, reject) {
var req = icAjaxRaw({
type: 'GET',
url: server+'/api/mydata?callback=?',
dataType: 'jsonp', //problematic
});
req.then(
function(result) {
console.log('myData', result.response);
resolve(result.response);
},
function(response) {
console.error('myData', response.jqXHR.responseText, response);
reject(response);
}
);
});
return promise;
}.property(),
... and in the template using that controller:
{{myData}}
This displays:
{
"_id": 101,
"_subscribers": []
}
Which looks like an intermediate object, not what the promise resolves to. I have a feeling that this might be related to something to do with the ember run loop, as mentioned here
How to get the template to display what is displayed in the console log?
ic-ajax
library, please don't create a tag for it. I removed it from your post for a reason. – Pyrologyic-ajax
which appears to be somewhat controversial. – Freehand