No method 'get' on backbone model save
Posted
by
user888734
on Stack Overflow
See other posts from Stack Overflow
or by user888734
Published on 2012-07-06T14:54:41Z
Indexed on
2012/07/06
15:15 UTC
Read the original article
Hit count: 251
I'm using backbone for a reasonably complicated form. I have a number of nested models, and have been computing other variables in the parent model like so:
// INSIDE PARENT MODEL
computedValue: function () {
var value = this.get('childModel').get('childModelProperty');
return value;
}
This seems to work fine for keeping my UI in sync, but as soon as I call
.save()
on the parent model, I get:
Uncaught TypeError: Object #<Object> has no method 'get'
It seems that the child model kind of temporarily stops responding.
Am I doing something inherently wrong?
EDIT: The stack trace is:
Uncaught TypeError: Object #<Object> has no method 'get' publish.js:90
Backbone.Model.extend.neutralDivisionComputer publish.js:90
Backbone.Model.extend.setNeutralComputed publish.js:39
Backbone.Events.trigger backbone.js:163
_.extend.change backbone.js:473
_.extend.set backbone.js:314
_.extend.save.options.success backbone.js:385
f.Callbacks.o jquery.min.js:2
f.Callbacks.p.fireWith jquery.min.js:2
w jquery.min.js:4
f.support.ajax.f.ajaxTransport.send.d
© Stack Overflow or respective owner