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.js views with nested tabs

I write an application which consists from nested tabs. As an example I took https://github.com/tbranyen/backbone-boilerplate. I also use RequireJS. I have at least two levels of nested tabs. Some of them have similar structure and I can reuse their…
Igor Timoshenko
  • 1,001
  • 3
  • 14
  • 27
1
vote
2 answers

Backbone router, pushstate, and relative urls

I'm making my first backbone app. I have pushstate enabled. In the router I have two routes. 'link1(/)' : 'link1Route', 'link2(/)' : 'link2Route' On my link1 page, I have a link pointing to link 2 like so:
landland
  • 2,117
  • 3
  • 20
  • 26
1
vote
1 answer

Setting URL in Backbone.Router for QUnit testing

I have a Backbone.Router based myRouter, that calls certain set() methods based on the URL: var MyRouter = Backbone.Router.extend({ routes: { "doSomething/:value": "doSetterOnModel", }, doSetterOnModel: function(value)…
nachtigall
  • 2,447
  • 2
  • 27
  • 35
1
vote
1 answer

having issue with backbonejs router

Scenario I am working on backbone app. What is happening right now is when user clicks edit link on page then it should show a form. I am trying to implement this using backbone routers rather than events. With events object it works perfectly fine.…
Om3ga
  • 30,465
  • 43
  • 141
  • 221
1
vote
2 answers

Backbone Boilerplate - dynamic routes - How to pass id into view?

I'm working with Backbone.js using Backbone Boilerplate and what I'm looking for is a way to pass an id of a dynamic route into the view. So the view can download stuff (via xhr) depends on the string in that id. Static route usually looks like…
Roman Liutikov
  • 1,338
  • 10
  • 17
1
vote
2 answers

Is it correct to do Ajax request from the model in Backbone.js?

Is it correct to do Ajax request from the "model" in Backbone.js? Is it more correct from the "router"? I don't use RESTful for Backbone (by other reasons). When I say "do Ajax request", I mean that Ajax functions are implemented in the model. That…
vicenrele
  • 971
  • 3
  • 19
  • 37
1
vote
2 answers

Are hashbangs a bad idea even if they are used as a fallback for facebook share

in backbone the hashbang was removed from the code with standard fallback to "#/path" which should be fine for crawling (see https://github.com/documentcloud/backbone/commit/10230e4d76e21f08a1dee1fe5d28994e2cf5f11d#commitcomment-477992) but if a ie9…
1
vote
1 answer

Backbone js Routes / Views relationship

I am building an app using Meteor and am having trouble understanding the relationship between Routes and Views. I have Routers working properly, but after having done research on calling new Views am baffled. Do I use App.navigate ? Do I call…
squeezemylime
  • 2,102
  • 3
  • 18
  • 26
1
vote
3 answers

Safari fires Backbone route twice

I'm having a headache with Backbone router in Safari I have this piece of code: app.navigate("ask/" + encodedSearchKey,true); and in my router: var AppRouter = Backbone.Router.extend({ routes:{ "":"main", …
Matthew Yang
  • 605
  • 1
  • 13
  • 23
1
vote
1 answer

Getting 'this.model is undefined' after event in Backbone app only in Firefox

I'm trying to get my head around Backbone and it's concepts. I've made a simple app so that I can learn how to learn more about Backbone.Router and how to integrate Backbone with Require.js. The app works great in Chrome, IE9 and Safari, however in…
cpeele00
  • 883
  • 4
  • 14
  • 29
1
vote
0 answers

Backbone Routing + URL Rewrite in IE

I've encountered a peculiar issue when dealing with Backbone routing. Our app is being hosted in example.com/photo/index.php, and we'd like to hook an event on it which when triggered, appear in the address bar as example.com/photo/. Below is…
1
vote
0 answers

Backbone JS automatically routing back to default

I've just started foundational work for a Backbone JS SPA (single page application). I'm using the basic Underscore templating support, and am having issues with unexpected routing occurring. Basically, the sign up view is shown initially as…
expo nats
  • 11
  • 2
1
vote
2 answers

Backbone.js: Single page application, routes and hrefs issue

It might sound a bit complicated. This is SinglePage, pushState enabled application. I have a route, for configuration: routes: { '': 'dashboard', 'configure/sites/:id': 'configure', 'configure/sites/:id/:section':…
Alexander Beletsky
  • 19,453
  • 9
  • 63
  • 86
1
vote
1 answer

Backbone.js: Why isn't event firing the second time?

I'm relatively new to Javascript and backbone. I'm hacking on a simple, beginner-level backbone app. I have two views: Home and NewEntry. From Home, I click on "new entry" to get to render NewEntry. From NewEntry, I click on "cancel" to render…
1
vote
1 answer

Backbonejs Router navigate function does not trigger router function

My route function is not triggered when I call app.navigate("/search#?q="+q, {trigger: true});. The route are defined well because if I refresh the page after the navigate() call, the route function is correctly triggered. Any ideas ?
Charles
  • 11,367
  • 10
  • 77
  • 114