ember.js - EmberJS - Computed property referencing firstObject do not update -



ember.js - EmberJS - Computed property referencing firstObject do not update -

i have model this:

app.conversation = ds.model.extend({ body : ds.attr('string'), created_at : ds.attr('date'), entry : ds.hasmany('entry', {async: true}), user : ds.belongsto('user'), allentriesloaded : ds.attr('boolean'), entryproxybody : function() { homecoming this.get('entry.firstobject.body'); }.property('entry.firstobject.body') });

as can see references entry hasmany relationsship in function entryproxybody. reference works great, calling entryproxybody indeed homecoming body-attribute first object in entry.

however problem is, computed property not updated, when new value added entry-store.

i add together new record this:

app.newcontroller = em.objectcontroller.extend({ actions: { save: function() { var entry = this.store.createrecord('entry', {body: 'test', created_at: new date() }); this.store.find('conversation', this.parentcontroller.get('id')).then(function(conversation) { conversation.get('entry').pushobject(entry); entry.save(); }); } }, });

however.. if update first object in entry straight using ember inspector in chrome, computed property changes should.

what missing? give thanks help!

i think might want observe changes each entry in entry array.

entryproxybody:function() { homecoming this.get('entry.firstobject.body'); }.property('entry.@each.body')

ember.js ember-data

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -