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
2 answers

Marionettejs Routes

I'm new to Marionette and I just can't get routes to work. I'm using Marionette's 2.4.1 version, and trying to do it the simplest way possible so it'll just work. This code works for old version of Marionette, v1.0.2, which was included in one of…
Pietrzm
  • 173
  • 2
  • 2
  • 5
1
vote
1 answer

Backbone.history.start() giving out error

Getting an error: Uncaught TypeError: undefined is not a function Anonymous function error is pointing to Backbone.history.start() Below is my index.html and main.js. I have a feeling, the jquery,underscore and backbone files may not be loading…
dreamer
  • 901
  • 2
  • 15
  • 38
1
vote
2 answers

Backbone router.navigate doesn't redirect

Honestly I feel a bit stupid asking this question because should be a very simple thing... In my app init, I have: window.myApp = Models: {} Collections: {} Views: {} Routers: {} initialize: -> window.router = new Backbone.Router …
Riccardo
  • 363
  • 1
  • 5
  • 11
1
vote
1 answer

How can i run a callback function after Backbone.history.loadUrl?

I tried the below code that does not work. Also i searched via google but find nothing. Backbone's official documentation does not have an entry about loadUrl. app_router.on('route:page', function(id, name) { ... }); app_router.on('route:file',…
fozuse
  • 754
  • 2
  • 11
  • 29
1
vote
2 answers

Get Current URL with query parameters in Backbone Marionette

URL : http://localhost:3000/dashboard?ID=10400&Name=10400 I'm trying to get the query params ID and Name from the URL but I get undefined. I have also tried backbone-queryparams but still it does not work. Any idea how to get the current URL with…
Srikanth Jeeva
  • 3,005
  • 4
  • 38
  • 58
1
vote
1 answer

Backbone router.navigate() giving Failed to execute 'pushState' on 'History' error

I'm trying to set up links and routing with Backbone (this is my first Backbone app). In particular, I want a link of the form /restaurants/:id to trigger the show route. This is my code: var App = { Models: {}, Views: {}, Collections:…
Adam Zerner
  • 17,797
  • 15
  • 90
  • 156
1
vote
1 answer

Browser's back button break my Backbone / Marionette app

I'm building a web app using Backbone and Marionette with Ruby on Rails on the server. The app works great, except for the back button of back browser (FF, Chrome, IE11) that breaks everything. Here is a really simple example that reproduce the…
1
vote
1 answer

Backbone router with no hashbangs

I've set up a super simple Backbone app with just a router and two views to try and nail down the correct way to handle routing with no hashbangs. var Router = Backbone.Router.extend({ routes: { '': 'index', 'episodes':…
1
vote
1 answer

Backbone: Render view that has been created before

I have the shell view that contains the navbar and the map. To this view is rendered other views that use the map previous rendered. When I'll go to the view perfil the map is removed, but the navbar is maintained, so far so good. My problem is when…
1
vote
1 answer

An app with sub-apps/modules should have one central AppRouter or each module manages its own?

I have an app which consist of several modules, eg: contacts, meetings, reminders. The urls are probably 1. /#contacts -> contacts module, listing page 2. /#contacts/45 -> contacts module, detail page of contact id 45 3. /#meeting …
Ksthawma
  • 1,257
  • 1
  • 16
  • 28
1
vote
1 answer

Backbone return to last URL - can't seem to trigger last route or hash

In my Backbone application, I am opening a modal window that changes the URL. The application loads at the URL of http://application.dev/#dashboard opening the modal changes the URL but does not trigger a route, the URL is changed too…
Udders
  • 6,914
  • 24
  • 102
  • 194
1
vote
2 answers

How do I get the 'this' element in Backbone click event?

When I click something, I'd like to do something to that element (i.e. add a class), though I don't believe that this 'this' element in my event handler is actually that element. Here is a sample bit of my code: var ApplicationRouter =…
user3126277
1
vote
1 answer

How to stop Backbone route event before trigger the function?

I want to be able to stop the route trigger in "before" function. The function above is working great. It calls "before" method correctly. Is there any suitable way to stop route when "before" method is called? Update: Solved! (function () { …
fozuse
  • 754
  • 2
  • 11
  • 29
1
vote
1 answer

Backbone.Marionette Routing not working

I was following the backbonerails.com screencast episode 6. But I can't get the routing to work as it was explained. Here is my code that is similar to what the screencast suggest: @Report.module "UsersApp", (UsersApp, App, Backbone, Marionette, $,…
1
vote
1 answer

Backbone Router not working to display view

I've been spending a lot of time learning Backbone's view's and models. I am now trying to understand routers and how to implement them. I am not quite sure why my router is not displaying the PriceView view. I would like to display the price that…
Mdd
  • 4,140
  • 12
  • 45
  • 70