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

Destroy or Replace Backbone JS views, When a route change is happen

I have a problem regarding Backbone JS views. When a Route change is happen it create new views according to the route function. But the previous views also exist. Therefore there are multiple views exists and couldn't perform At the top of each…
1
vote
1 answer

Backbone.history.navigate doesn't save parameters

I have some routes: routes: { "": "main", "!/": "main", "!/page": "page", "!/page/:id": "page" }, Then I have some html link, for example: my link If i press to my link I access to url…
Jenya
  • 21
  • 1
1
vote
2 answers

Backbonejs view binding conceptual feedback

I ran into this article (http://coenraets.org/blog/2012/01/backbone-js-lessons-learned-and-improved-sample-app/) and was wondering if the idea of binding and rendering views in the router after instantiating them is best practice. I have been…
1
vote
1 answer

Events not working after route switching in Marionette

I have a Marionette based application, and now trying to include Material Design Lite via npm. Also, I have included the CSS for Material Design into my bundler and gulp flow and this is working fine. However, when I switch routes for example, I…
1
vote
1 answer

backbone router several root, how to load this properly?

I'm missing something here. My problem is very simple I think. mysite.com/app and mysite.com/transaction both load a different html page but they load the same router. For each case I need my router to be written in order…
François Richard
  • 6,817
  • 10
  • 43
  • 78
1
vote
1 answer

backbone fragment route is added to root when has :attributes

I'm quite new using Backbone and now I have found this new issue. I use the route "jobprofile" to create a view which fetch the data from urlRoot= "job" (doing job/id using a default id) BUT if I add the :id to the route as "jobprofile/:id" which I…
juangv
  • 111
  • 11
1
vote
1 answer

Rendr App.router.currentView is undefined

When my Rendr app boots, App.router.currentView always evaluates to undefined and this in turn breaks my client side rendering as if (this.currentView) { this.currentView.remove(); } does not evalutate to true in the funcion…
LongJeongS
  • 27
  • 1
  • 5
1
vote
1 answer

Get the name/type of a backbone model

I have a somewhat generic view that can except 6 different types of models. I create the view and pass in the model like this: var view = new MyView({ model: myModelType //can be 1 of 6 different model types }); In the view, I…
SkyeBoniwell
  • 6,345
  • 12
  • 81
  • 185
1
vote
1 answer

Having trouble with Marionette JS router

I am having a trouble with my router and controller. On my app's before:start, I have a handler that fetches collections of Leads and Vehicles. I have a single region, with my layout view as: var App = new Marionette.Application({}); var…
vintorg
  • 217
  • 4
  • 17
1
vote
1 answer

Backbone router stop propagation

This is a backbone front end. I have this template on the index.html Then…
1
vote
1 answer

Simplify Backbone Router for multiple optional values

App.Routers.Applications = Backbone.Router.extend({ initialize: function () { this.view = Object.create(App.Views.Applications); this.view.init(); }, routes: { 'search/:query/status/:status/page(/:page)':…
Pratheep
  • 936
  • 1
  • 7
  • 17
1
vote
1 answer

BackboneJs Browser refresh should load the same page

I'm new to backboneJs. Currently when i do browser refresh, it takes back me to login page. var AppRouter = Backbone.Router.extend({ routes : { // Pages 'startup' : 'LoginScreen', 'Home' : 'HomeScreen', …
monda
  • 3,809
  • 15
  • 60
  • 84
1
vote
0 answers

Back button duplicating ajax requests on view load

Edit I put a console.log in the fetch success callback of the home view (#/). These are the cid ids of the fetches each time the page loaded. You can see by the end there are 6 fetch requests being made when on the original page load there is only…
Kylee
  • 1,625
  • 1
  • 31
  • 54
1
vote
0 answers

Backbone - edit View template before render

I'm trying to render a Bootstrap modal with Backbone. I need to check some HTML elements from the template (using $('#tpl-create-details').html()), and hide them before render, but I'm facing some problems. Element is not hidden even if I add…
1
vote
1 answer

Backbonejs and defaultRoute

I start to learn how to use backbonejs for a web app and I've got a little problem with the defaultRoute when the app is launch. Here is my script var AppRouter = Backbone.Router.extend({ routes: { "user/:id": "getUser", …