So I am trying to assign a variable, it runs ok if there is no ajax call but trying to assign the response does not work (response data is ok, I can console.log it) Here is my component code, upon editing the objects array anywhere but in the ajax call it updates correctly.
import Component from '@ember/component';
import Ember from 'ember';
export default Component.extend({
objects: [],
actions: {
loadObjects: function() {
Ember.$.ajax({
url: 'http://ift.tt/2zsz6qg',
type: "GET"
}).then(function(resp) {
this.set('objects', resp);
console.log(resp);
});
}
}
});
Any idea? Been smashing my head for hours
Aucun commentaire:
Enregistrer un commentaire