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

Can't make marionette router to work

I am am having difficulties with making marionette's router to work, precisely the router's controller. Here is my code: App.RouterController = Marionette.Controller.extend({ render: function(){ alert(123); …
hjuster
  • 3,985
  • 9
  • 34
  • 51
1
vote
1 answer

Adding routes to Backbone.js Router including 404 handler

This question is similar to 9595182 which explains how to programatically add routes. This is great, however I am trying to add a catch all handler. When I do I get a 404 for all routes. Workspace = Backbone.Router.extend({ routes: { "help":…
Mark Robson
  • 1,298
  • 3
  • 15
  • 40
1
vote
1 answer

Why router.navigate() in Backbone.js do not load required view?

I'm new in BackboneJS, RequireJS, JQuery apps development. I want to change the current view using router.navigate(). This is the router configuration: define([ //Libraries to load "jquery", "underscore", "backbone", …
pedrozopayares
  • 2,856
  • 1
  • 13
  • 14
1
vote
1 answer

Backbone SPA: Best practice for loading new routes?

What is the 'best practice' way to load a new route in a backbone single page app? Right now, my app has a mix of these two methods: 1) In my html Some Route Or I can define an event in my view: 2) In my…
1
vote
0 answers

Backbone router - fallback for IE

For IE, versions lower then 10, I made a fallback, so the router is not using the pushState, but the hashchange. The initialize method of the router looks like this: initialize: function(){ var self = this; Backbone.history = Backbone.history…
1
vote
1 answer

Backbone router with regex and extend

When googling, I see lots of examples like this: App.Router = Backbone.Router.extend({ routes: { '': 'index', 'show/:id': 'show' }, index: function(){ $(document.body).append("Index route has been called.."); }, show:…
Cotten
  • 8,787
  • 17
  • 61
  • 98
1
vote
1 answer

'undefined' is not a function (evaluating 'Backbone.$(window).on('hashchange', this.checkUrl)')

I'm trying to configure Router with Backbone.js and receiving an exception at line 1414 of backbone.js 1.1.2 The error exists with Safari and Chrome: [Error] TypeError: 'undefined' is not a function (evaluating 'Backbone.$(window).on('hashchange',…
aug2uag
  • 3,379
  • 3
  • 32
  • 53
1
vote
1 answer

events not firing after re-render in backbone.js

I am facing a problem while trying to click submit after re-render. This is my view: ShareHolderInfoView = Backbone.View.extend( { template : 'shareholderinfo', initialize: function() { this.model = new ShareHolderInfoModel(); }, render :…
1
vote
2 answers

Design pattern for persisting model and view across routes

Let's say I have a search form at /search with a QueryView representing the search form. When the user submits a query, I would like to route to /results and add a ResultView for the results, keeping the QueryView in case the user wants to do a new…
elplatt
  • 3,227
  • 3
  • 18
  • 20
1
vote
4 answers

Backbone.js Where and When should I fetch my collection data?

I'm a bit puzzled by when and where to instantiate collections and fetch them in a backbone App. I've seen it done a few ways now, and had a working in my very simple little CRUD contact manager app Im messing around with, but I'm sure there are…
1
vote
2 answers

Backbone router not working on page load

I have a backbone application which works great, except for the routing on page load. I need to use the router to instantiate the correct view on page load, but for some reason the functions wont fire. Here is my code: var Router =…
lukehillonline
  • 2,430
  • 2
  • 32
  • 48
1
vote
1 answer

Backbone is interpolating query string in model URL. How do I stop it?

I have a Backbone model that looks like this ... var Address = Backbone.Model.extend({ urlRoot: '/address/' }); return { address: Address } }); I have a template that prints out an address in a form. The template is rendered by a view…
garey
  • 67
  • 1
  • 9
1
vote
1 answer

Backbone routes: optional params in root not matching

I'm trying to get GitHub-esque route matching through Backbone. This means that hits to /:userName should get caught last, after every other route has been checked. In my current setup my unit route gets triggered on all calls, is there a way to…
1
vote
1 answer

How to implement cascading dropdowns using results from an HTTP POST request on backbone.js

There is an address view which renders a form with the basic address fields including zip code textbox and city/suburb dropdown. Ideally when the user types in the the zip code, the city dropdown should automatically populate with values…
1
vote
1 answer

BackboneJS - Router issues - how to get clean URL's

ok I have {{#each mainmenu}}
  • {{this.name}}

  • {{/each}} and in my router routes: { '': 'index', 'pages/firstpage' : 'firstpage', 'pages/secondpage' : 'secondpage', …
    SHT
    • 700
    • 4
    • 18
    • 39