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
1
vote
1 answer

Backbone router with infinite optional parameters

I am creating a single-page application. Initially, I am using the URL "/stop/stop_id", which then loads content using stop_id. I would like to support multiple stops. I imagine an URL like "/stop/stop_id/stop/stop_id", where it can grow by…
Henrik
  • 3,908
  • 27
  • 48
1
vote
1 answer

backbone.js pass param from router to views

Below is my router function where i have an id as the parameter.My question is how to pass the id into the camp views..Thanks..i tried the following..When i do a alert in views it says undefined Router.js editcampaign :function(id){ …
Rajeev
  • 44,985
  • 76
  • 186
  • 285
1
vote
1 answer

Backbone.Marionette: Router Not Routing Correctly

So I have a button in my landing page view that, when clicked, should route my user to the register URL, initiate my register function in my router, and render the register view. The only problem is that it seems to be routing incorrectly. Here's…
1
vote
1 answer

PlayFramework 2.1 : Loading page-specific Javascripts with Require.js & Backbone.js

I would like to load in page-specific Javascripts that have dependencies. I know about: @scripts as described in the documentation But I'd like to use Require.js to manage my module dependencies : require([ 'jquery', 'bootstrap', 'unicorn' ],…
1
vote
1 answer

has no method 'toJSON' error in my view

I'm learning backbone.js and I'm building my first multimodule app. I'm getting an error that I've never seen before and I think I know the reason, but I can't see how to fix it. I believe it's because the model isn't actually available to the view…
Dave Merwin
  • 1,382
  • 2
  • 22
  • 44
1
vote
1 answer

Good pattern for doing additive routes in Backbone

I have looked at subrouting ideas like those in BackboneMVC and Backbone Marionette. I think I'm looking for something a little different. Has anyone come up with good patterns for, not subroutes, but additive routes? Say, for example, you have a…
SimplGy
  • 20,079
  • 15
  • 107
  • 144
1
vote
1 answer

Using query strings in backbone (1.0.0)

i have a situation here that i can't seem to figure out. Please if anybody knows how to resolve this i would love to hear suggestions.Thanks I have a "global view" that is visible on a subnavbar in the app, that is a calendar, this calendar serves…
Julian
  • 171
  • 2
  • 10
1
vote
0 answers

Using the Backbone.js router on a play framework app

I've built a simple REST API using the Play Framework 2.1 (just controllers that expects different kind of calls on different routes) The API is already working fine but now I am trying to add a front end app using mostly JavaScript and for this…
jdrm
  • 621
  • 2
  • 8
  • 21
1
vote
1 answer

Backbone router triggered by page refresh

I got a question about backbone router, pls help: I have a router: define(['views/index', 'views/login'], function(indexView, loginView) { var SelinkRouter = Backbone.Router.extend({ currentView: null, routes: { …
Hetfield Joe
  • 1,443
  • 5
  • 15
  • 26
1
vote
1 answer

How to organize groups of views that are common across pages?

Suppose that you have a group of backbone views that combine on the page to create one pretty complex widget that's going to appear on multiple pages. (An example of this might be a form where each input is its own view and perhaps has complex…
Denise
  • 1,947
  • 2
  • 17
  • 29
1
vote
1 answer

How to prevent backbone router to call event on page load

I am a bit confused at the moment. My routes functions are being executed on the first load, which is not good in my case, because I am rendering the content with these functions and on the first load I am getting the duplicated content... Ok, I can…
hjuster
  • 3,985
  • 9
  • 34
  • 51
1
vote
1 answer

Backbone routing for modular and multiple views

So I'm in a bit of dilema with my Backbone routing design and am trying to see what other folks think or have attempted to do to solve this problem. The basic problem is that I'm writing an application with multiple views, and nested views within…
adrian
  • 2,326
  • 2
  • 32
  • 48
1
vote
2 answers

Backbone routing, multiple routers after backbone.history starts

So I have a bit of a problem. I'm in a situation where I need to have multiple Backbone.Routers which handle their own routes accordingly etc. and I dynamically load them based on what the main router (Router 1 in the following example) knows about…
adrian
  • 2,326
  • 2
  • 32
  • 48
1
vote
2 answers

Backbone.js router url contains parameter

How can i match route if the url contains somewhere a parameter with a specified action ? Like myaction/someparam1/someparam2/PleaseMatchMeIfYourFindMe/someparam3
MR.ABC
  • 4,712
  • 13
  • 44
  • 88
1
vote
1 answer

Two-ways route functionality

When clicking a tab in my Backbone app the routes work as expected and render the appropriate view: switchView: function(event) { event.preventDefault(); // Get clicked tab var target = $(event.currentTarget); // Tab is already…
jdlm
  • 6,327
  • 5
  • 29
  • 49