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
3
votes
3 answers

making backbone models & collections available globally using requireJS

i am a newbie to web application development. i have a backbone model named LoginModel. I want to create an object of it and make it globally accessible from any Backbone View which will be loaded dynamically. Here is my…
yokks
  • 5,683
  • 9
  • 41
  • 48
3
votes
1 answer

backbone navigate not listened by the routers, but onload it works

I am developing a application using requirejs and backbone, in the index view (index page) i am getting 2 difficulties... when i use the navigate function like this: this.navigate("dashBoard/"); it's not works, in case if i…
3gwebtrain
  • 14,640
  • 25
  • 121
  • 247
3
votes
1 answer

Backbone and composite models in REST api - is it possible?

First I apologize as I am not sure the question title accurately describes what I am trying to do. I love/hate backbones REST api structure, but I am trying add on to it a bit and support a 'graph' of relationships between the models. So the…
Matthew Ward
  • 351
  • 3
  • 12
3
votes
1 answer

backbone router does not pick up the function

I tried to use backbone with a pushstate: $(document).ready(function(){ var App = Backbone.Router.extend({ routes: { "/": "homepage", "/questions": "questions" }, homepage: function()…
Salvador Dali
  • 214,103
  • 147
  • 703
  • 753
3
votes
2 answers

Adding backbone routes asynchronously.

I'm stuck with a big backbone application. It's running different applications within the main application. And we want to add the apps and also the routes asynchronously to the big app. What I do now is to add the different apps asynchronously with…
Toon Nelissen
  • 41
  • 1
  • 5
3
votes
1 answer

Backbone Router not working using boilerplate

Ok, I think this is something simple, however I am being to stupid to see it. Here is my code in backbone using the backbone boilerplate method require([ "app", // Libs "jquery", "backbone", // Modules …
mcclennon19
  • 623
  • 2
  • 6
  • 21
3
votes
2 answers

How to prevent routing in Backbone.js?

When I click 'Cancel' from First page - it's ok. But 'Cancel' doesn't work when I move to 'Second page'. In this case router redirects application to "" route. I need to prevent this redirection. "Cancel" - hide links, "Second page" - move to Second…
3
votes
1 answer

backbone and history push state

Using backbone, is it any way to store some data in the history so it can be retrived when a back is called? In a none backbone application I the application will be something like the following. When executing an action: //When doing some…
Mateu
  • 2,636
  • 6
  • 36
  • 54
3
votes
3 answers

How could I use Router in View module in modular Backbone.js app?

I use RequireJS to organize my Backbone app and my Router module is as follows: define([ 'jquery', 'underscore', 'backbone', 'collections/todos', 'views/todosview' ], function($, _, Backbone, TodosCollection, TodosView){ var AppRouter =…
chaonextdoor
  • 5,019
  • 15
  • 44
  • 61
3
votes
3 answers

Backbone.js Router initialization doesn't run immediately

My code is as follows: var AppRouter = Backbone.Router.extend({ _data: null, _length: 0, _index: null, _todos: null, _subtodolist: null, _subtodos: null, routes: { "*action": "index", "category/:name":…
chaonextdoor
  • 5,019
  • 15
  • 44
  • 61
2
votes
1 answer

What's the difference between Backbone.history.navigate and this.router.navigate

What is the difference between Backbone.history.navigate and this.router.navigate? Why would sometimes the former work while later won't?
Rastee
  • 73
  • 1
  • 6
2
votes
0 answers

Multiple dashes in URL causes 404

Currently i'm rewriteting my titles to slug. But when i make a slug from a sentence with a dash in it. The dash is included in the slug. So this Awesome Title - 2017 get's converted to the slug awesome-title---2017 I know it's a quick fix, but i was…
2
votes
2 answers

Backbone.History.extend( { loadUrl: ...} ) returning false for valid routes

I'm trying to extend Backbone.History.loadUrl() to catch 404 errors: var History = Backbone.History.extend({ loadUrl: function() { var match = Backbone.History.prototype.loadUrl.apply(this, arguments); if (!match) { …
Francine
  • 51
  • 1
  • 2
2
votes
1 answer

how to send input text value or data one view to another view?

could you please tell me how to send data from one view to another view .Actually I have one input field and button on my main screen .I want to send data of input text from one screen to another screen on button click .I want to send text of input…
Shruti
  • 1,554
  • 8
  • 29
  • 66
2
votes
1 answer

how to move one view to another view?

could you please tell me how to navigate from one page to another page in backbone . I want to show second html on button click how it is possible I so like that .I resister event like that events: { 'click #click':'moveTonext' }, …
user944513
  • 12,247
  • 49
  • 168
  • 318