ember.js - Extending an Ember model with a custom variable -
ember.js - Extending an Ember model with a custom variable -
my ember app has section model. has 'name' field , i've extended 'summary_of_changes' field. when effort length of name field good. attempts length of 'summary_of_changes' field generating error (see below) , driving me crazy.
this works:
# coffeescript app.sectioneditcontroller = ember.objectcontroller. isreadytosave: (-> @get('model.name').length > 3 ).property('model.name'),
but (almost identical code) doesn't
app.sectioneditcontroller = ember.objectcontroller. editmode: true, isreadytosave: (-> @get('model.summary_of_changes').length > 3 ).property('model.summary_of_changes'),
..and produces next error.
‘uncaught typeerror: cannot read property 'length' of undefined’
by way of farther background, store rails api , have model 'section' of business plan.the model contains: name, details not 'summary_of_changes'.
when save changes want submit summary_of_changes string in controller save save_comment along other save_comments changes section.
in essence want add together summary_of_changes temporary field saves model cleared blank 1 time again 1 time model saved.
in ember added field model:
app.section = ds.model.extend name: ds.attr('string') details: ds.attr('string') sort_order: ds.attr('number') plan: ds.belongsto('plan') summary_of_changes: ds.attr('string')
i have modal code (see illustration jsbin http://jsbin.com/hekaga/1/edit?css,js,output) refers 'summary_of_changes' field , able bind field changes modal live alter same named field in main section template.
i don't understand why though can see summary_of_changes field on template drop related modal , have 2 bound can't inquire it's length able other field on model.
versions: i'm running latest ember-rails (0.15.0) includes ember 1.5.11 , ember-data 1.0.0.beta.5
ember.js ember-data ember-model ember-rails
Comments
Post a Comment