How do I update a model property once a promise (via Ajax call) has returned? Here is my go at it that is not working. In the docs, it appears observing takes place using Ember.set but the model I am returning is not an Ember model object so I don't think that works.
import Ember from 'ember';
export default Ember.Route.extend({
model: function() {
var model = { title: "Lorem Ipsum" };
var userSubscriptions = [];
var App = this;
Ember.$.getJSON('http://localhost:1337/company/usersubscription/active/', parameters, function(userSubscriptions) {
userSubscriptions.forEach(function(data) {
var userSubscription = App.store.push('usersubscription', data);
userSubscriptions.pushObject(userSubscription);
model.title = "No Lorem Ipsum";
model.objects = userSubscriptions;
});
});
return model;
}
});
Ember.Object
, what do you try to achieve and what is not working in detail? – kunerdvar model = Ember.Object.create({title: "Lorem Ipsum"});
. But it seems that you are fighting a bit against the framework. If you could explain what you try to do more in detail, then maybe I or someone else can help you more. – kunerd