Matt Blair

Matt Blair

I read that you learn more from a poor example than from a correct one. I don't believe this but that means my site will be a success.

Ember - The content property of DS.PromiseArray should be set before modifying it

Ember - The content property of DS.PromiseArray should be set before modifying it

1-Minute Read

The content property of DS.PromiseArray should be set before modifying it

If you see the following error in Ember.Data 1.0.0-beta.7:

The content property of DS.PromiseArray should be set before modifying it

The issue is with changing the contents of an async field.

//program.js
Program = DS.Model.extend({
  styles: DS.hasMany('style', {async: true}),
});

Style = DS.Model.extend({});

and then used like so:

program.get('styles').pushObject(style);

That code will throw the exception listed above. To work around this behavior, do the following:

program.get('styles').then(function(styles){
  styles.pushObject(style);
});

A gist talking about the issue is here.

Recent Posts

Categories

About

This theme was developed for Hugo.