Questions tagged [backbone-routing]

Backbone.js is a JavaScript framework that provides structure to RESTful web applications. Backbone also includes URL fragment or History-based routing. This tag is for questions related to Backbone's routing system.

From the fine manual:

Web applications often provide linkable, bookmarkable, shareable URLs for important locations in the app. Until recently, hash fragments (#page) were used to provide these permalinks, but with the arrival of the History API, it's now possible to use standard URLs (/page). Backbone.Router provides methods for routing client-side pages, and connecting them to actions and events. For browsers which don't yet support the History API, the Router handles graceful fallback and transparent translation to the fragment version of the URL.

419 questions
2
votes
1 answer

Backbone/Marionette - Multiple routers, deep linking?

We are using backbone/marionette to build a large application that is split up into many independent modules. The main application manages the header, menus, notifications and footers. It also instantiates the router of each module and passes to it…
Software Engineer
  • 15,457
  • 7
  • 74
  • 102
2
votes
2 answers

backbone.js - parentheses needed after "new" keyword?

I've been working through codeschool.com's tutorial on backbone.js And submitted: var AppRouter = new Backbone.Router.extend({ //code }); $(function(){ AppRouter.start() }); and it gave the following error message: TypeError: 'undefined' is not a…
Paul Nogas
  • 309
  • 3
  • 16
2
votes
2 answers

Backbone: before route

There are lot of topics in google, but any full and working example. How can I wrap router's navigation in such way that I can check conditions and cancel navigation if needed? P.S. I see ideas with _.wrap, overriding…
VB_
  • 45,112
  • 42
  • 145
  • 293
2
votes
1 answer

Backbone route is firing twice

I'm using Backbone with Marionette and I have one troublesome route that seems to be firing twice, with different route parameters. When you click back, it brings you back to the first firing of the route, not the original page. Using Backbone…
T Nguyen
  • 3,309
  • 2
  • 31
  • 48
2
votes
2 answers

Is there a way to stop a Backbone Router?

Is it possible to close or stop a Backbone Router from listening to its defined routes? I ask because I have been testing Backbone SubRoute (https://github.com/ModelN/backbone.subroute), setting up an application that has many spaces in which a user…
jay
  • 12,066
  • 16
  • 64
  • 103
2
votes
1 answer

Backbone routes: optional parameter not matching

I am using the following configuration for my router: var Router = Backbone.Router.extend({ routes: { 'item/:param(/:param-2)': 'func1', // Default '*actions': 'defaultAction' …
Deepak Joy Cheenath
  • 5,796
  • 5
  • 25
  • 29
2
votes
1 answer

Backbone routes can not be called

I've got a very simple routes. When I click my < a href="#content_ft"> for the first time, the route function matched(ft) will be called. But here comes the question, I click the < a href="#content_ft"> for the second time, the route function(ft)…
Jason Xu
  • 845
  • 8
  • 22
2
votes
2 answers

Is there any Backbone-friendly way to detect back button presses?

Stack Overflow has several questions related to detecting back button presses, the most relevant one being a list of libraries for doing exactly that: https://stackoverflow.com/questions/116446/what-is-the-best-back-button-jquery-plugin The problem…
machineghost
  • 33,529
  • 30
  • 159
  • 234
2
votes
1 answer

How to design a controller in Backbone.js?

I am interested in having a controller to coordinate rendering, event processing, URL router navigation and network access. A bit similar to what a Controller does in Spine: http://spinejs.com/docs/controllers In the realm of Backbone, what I could…
poseid
  • 6,986
  • 10
  • 48
  • 78
2
votes
2 answers

Backbone.js Marionette router and nested views

I'm diving into the whole "single page application" and Backbone.js (specifically Marionette) stuff. I'm working on a decently complicated application. I'm wondering how you set up the router to handle nested views so the "containing views" are…
Jeremy
  • 1,023
  • 3
  • 18
  • 33
2
votes
1 answer

Using Backbone.js Router with No Hash

I am building a multi-page application and would like to leverage Backbone's Router to initialize my views on page load. I haven't been able to find a way to leverage routers without using hashes and I don't need or want to use push state.…
Kevin O'Hara
  • 337
  • 3
  • 14
2
votes
1 answer

Dynamically create backbone routes

Here is my backbone router: var Router = Backbone.Router.extend({ routes: { "": "home", "home": "home", "about": "about", "works": "works", "work/:id" : "work", "news": "news", "contact":…
hjuster
  • 3,985
  • 9
  • 34
  • 51
2
votes
4 answers

Backbone routing doesn't work when converted to TypeScript

I'm trying to convert a basic Backbone.js router declaration to TypeScript. var AppRouter = Backbone.Router.extend({ routes: { "*actions": "defaultRoute" }, defaultRoute: function () { document.write("Default Route…
orad
  • 15,272
  • 23
  • 77
  • 113
2
votes
1 answer

Backbone - changing root for http/url requests (but not for backbone routes)

I have an web app that I am transiting into a trigger.io application. I am trying to get it to work as a single page app, and currently, it is fraught with issues. One of my issues right now is that this is how we set the url for api…
meow
  • 27,476
  • 33
  • 116
  • 177
2
votes
2 answers

Running an Backbone app as an independent JS application - Routes not working

currently, I run backbone as the front-end of my rails 3.2 application. I need to migrate it into an independent JS application, as part of my putting it as part of Trigger.io. It now exists as its own index.html file, referencing the assets…
meow
  • 27,476
  • 33
  • 116
  • 177