Questions tagged [backbone-model]

Models in the Backbone.js library.

Docs

325 questions
1
vote
0 answers

"Too much recursion" backbone error

I am using BackboneJS for my application. In my scenario, I have a collection (say booksCollection) with list of all the books (say model Book). I need to get a certain book based on the id and pass it to a view. I have the following code: var book…
Anji
  • 725
  • 1
  • 9
  • 27
1
vote
1 answer

How to pass a model(data) from one view to another in Backbone and edit/delete it?

I have a web application using BackboneJS. In this application, I have a LayoutView.js file in which there is a Backbone View (called LayoutView). LayoutView has other functions (methods) that call other views. I am fetching some data in the…
1
vote
2 answers

Backbone.js post model

I have a model which id is a code that must be written by the user and this code will be the primary key on the DB. So, to create a new register I need to write the code but when i call the save() method I'm expecting one POST, but because de…
pmestima
  • 129
  • 2
  • 8
1
vote
1 answer

How to embed a model object within another model object

I am trying to create a model object which contains another model object using the following code //create a question object to be embedded question = new…
Zhen
  • 12,361
  • 38
  • 122
  • 199
1
vote
1 answer

display fetched result of backbonejs model

I'm trying to show single model fetch result in html form Here is my backbone.js part: window.Category = Backbone.Model.extend({ urlRoot : "../myWs/category/" }); window.CategoryView = Backbone.View.extend({ el : $('#category_details'), …
JiboOne
  • 1,438
  • 4
  • 22
  • 55
1
vote
2 answers

Backbone -- Can a model and a collection have their own separate urls?

I plan on doing separate fetches for an individual model and its collection, but would like the collection to follow the same structure of the model. Currently, I have separate urls for each, but its crashing on a jQuery error Uncaught TypeError:…
Adam Storr
  • 1,438
  • 2
  • 21
  • 46
1
vote
2 answers

GET, PUT and DELETE requests on an external api with backbone.js

I have a model named TodoModel and a collection named Todos. The url that I use to fetch data is an external api, hence I am overriding my collection's url function as url:function(){ return "http://abc.com/data" } This works fine when I write…
Sudo
  • 559
  • 1
  • 8
  • 15
0
votes
2 answers

How can I tell my javascript to wait until the server is done?

In my web app, I have a page where users can copy books from their library. On the website, when a user clicks the copy button, the app executes this bit of Backbone.js code: clonebook: function () { var self = this; …
0
votes
1 answer

How do you clone an entire backbone model?

I have a large backbone model that is fairly complex and contains nested arrays and objects. If I clone using the backbone method, like this: var model2 = model1.clone(); It will clone the top-level properties and arrays, but anything deeper, is…
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185
0
votes
1 answer

Backbone model with a function in defaults returning object to use in jquery template

I have a model something like this and I want to access those object's key's values in a jquery template var Item = Backbone.Model.extend({ defaults : { name : "abc" designation: "def" }, …
Sitesh Roy
  • 387
  • 4
  • 8
0
votes
1 answer

Is there a way to pass .Net Core 2 appsettings.json properties down to backbone components?

In my appsettings.json file, I have a flag that I can set to enable or disable a learning assignment called "Telescope", like this: "Telescope": { "Enable": false }, In my Startup.cs, I can successfully check to see if it is enabled or…
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185
0
votes
1 answer

BackboneJS, save method is fired twice

I have an app in which I am not using Backbone Views, only Backbone Models. The structure is the one that follows. #html Personal ">
Jorge
  • 333
  • 1
  • 5
  • 17
0
votes
1 answer

backbone js more than one class and function not working

When I tried with a single class and property it works fine. But if I'm using it with multiple class properties, it throws an error, such that mixchi is not a function. var sinchan = Backbone.Model.extend({}, { himavari: function() { …
GGSankar
  • 29
  • 8
0
votes
1 answer

Backbone model.set on a nested object in the response

I have an API response that has a nested object like below - { name: '', age: '', departments: { size: '', head: '' } } How do I set the head attribute of the departments object? I tried doing the…
arjary
  • 169
  • 1
  • 12
0
votes
1 answer

Structure of Backbone Models and Collections based on JSON

I have this web app that tracks daily nutrients consumption through foods and presents them in a neat timeline. I am new to Backbone and I am trying to structure my models and collections. How can I model the following JSON into Backbone…