757
votes
12answers
132k views
Knockout.js vs Backbone.js?
I'm a long-time developer who's getting more and more into in-browser development. (The modern tools are awesome!) I need to build some bigger, longer-running client-side interactions to go with my ...
243
votes
4answers
38k views
Backbone.js vs Spine.js
There seem to be two very similar JS frameworks. Backbone and Spine. Apparently Spine is inspired by Backbone but quite different.
I've no experience with either of them.
What are the pros/cons of ...
194
votes
5answers
58k views
123
votes
5answers
28k views
Explanation of <script type = “text/template”> … </script>
I just stumbled upon something I've never seen before. In the source of Backbone.js's example TODO application (Backbone TODO Example) they had their templates inside a <script type = ...
121
votes
11answers
33k views
What is the purpose of backbone.js?
I tried to understand the utility of backbone.js from its site http://documentcloud.github.com/backbone, but I still couldn't figure out much.
Can anybody help me by explaining how it works and how ...
103
votes
1answer
27k views
What are the key differences between Meteor, Ember.js and Backbone.js? [closed]
Learning Ember.js / Backbone.js has been on my to-do list for a while. Now that Meteor is out, I am just wondering if anyone with experience of Meteor, Ember.js and Backbone.js can summarize the key ...
102
votes
2answers
28k views
How to override Backbone.sync?
I'm trying out Backbone.js, and one of the things I'm trying is to make a call to a remote API, so I need to be able to override Backbone.sync, as I understand the documentation.
There isn't an ...
101
votes
2answers
33k views
Loading backbone and underscore using requirejs
I'm trying to load backbone and underscore (and jquery) with requirejs. With the latest versions of backbone and underscore, it seems kind of tricky. For one, underscore automatically registers ...
78
votes
7answers
14k views
How to handle initializing and rendering subviews in Backbone.js?
I have three different ways to initialize and render a view and its subviews, and each one of them has different problems. I'm curious to know if there is a better way that solves all of the problems:
...
77
votes
1answer
14k views
Backbone.js: `extend` undefined?
Just getting started with Backbone.js. Simply including Backbone (either dev/production versions) causes the error:
Uncaught TypeError: Cannot call method 'extend' of undefined on Line 128:
// ...
73
votes
7answers
14k views
“Single-page” JS websites and SEO
There are a lot of cool tools for making powerful "single-page" JavaScript websites nowadays. In my opinion, this is done right by letting the server act as an API (and nothing more) and letting the ...
66
votes
5answers
26k views
How to use if statements in underscore.js templates?
I'm using the underscore.js templating function and have done a template like this:
<script type="text/template" id="gridItem">
<div class="griditem <%= gridType %> <%= ...
59
votes
5answers
24k views
backbone.js structuring nested views and models
Using backbone.js:
I have a top level ModelA that contains 2 attributes and 2 nested models, ModelB and ModelC. ModelB and ModelC each have 2 attributes as follows:
ModelA
attributeA1
...
55
votes
2answers
35k views
Backbone.js fetch with parameters
Following the documentation, I did:
var collection = new Backbone.Collection.extend({
model: ItemModel,
url: '/Items'
})
collection.fetch({ data: { page: 1} });
the url turned out ...
54
votes
4answers
27k views
How do I fetch a single model in Backbone?
I have a Clock model in Backbone:
var Clock = Backbone.Model.extend({});
I'm trying to get an instance of that that has the latest information from /clocks/123. Some things I've tried:
a ...