My models already have a defaults hash. When parts of the view/page are reset, I wish to reset the models back to their original defaults.  Currently, I explicitly set each attribute to its default value. Is there anything built in or a JavaScript/Un...
Here's the goal: I have a parent model. It is in a collection called parents. In a parent is a collection of children. So, when I instantiate the parents collection, I get the parent models, each with the collection of children in them.  I've...
I have a simple question about Backbone.js' get and set functions.  1) With the code below, how can I 'get' or 'set' obj1.myAttribute1 directly?  Another question:  2) In the Model, aside from the defaults object, where can/should...
The reason I'm late to the backbone party is because I'm worried it wont play nicely with my existing webservice.  I have even got to the point where I'm using my own version of backbones controllers and models, but its fruitless to just...
In my view's method below, my model gets synced with the server if I understand the create() method properly. However, the console.log of this.model.id still returns undefined and this.model.isNew() returns true. The POST shows an id in the retur...
My API response:  {   firstName: '',   lastName: '',   notifications: [     {       category: '1',       subcategory: '',       source: '',       optInDate: '',       optOutDate: '',       activ...
I have the following Backbone Model and Collection  /**  *  DataPoint  */ var DataPoint = Backbone.Model.extend({     defaults: {         ts: null,         value: null     } });  var DataPointCollection = Backbone.Collection.extend({     model: DataP...
I'm having an error trying to add multiple models from the server to a collection. It throws the error:   Uncaught TypeError: Cannot read property 'idAttribute' of undefined   Here is a test example which gives same error:  <script typ...
I have a case where I am creating multiple views for a single model. When I close a view, I am removing the model from the collection.   But in case of multiple views, there are other views that depend on the model.   So, how can I know when there ar...
This is the source for BackboneFactory, a Backbone equivalent of FactoryGirl:  // Backbone Factory JS // https://github.com/SupportBee/Backbone-Factory  (function(){   window.BackboneFactory = {      factories: {},     sequences: {},      define: fun...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.