Questions tagged [canjs-routing]

can.route enables two-way binding with window.location.hash. This tag should be used for questions about can.route or how to structure a single-page application that behaves like a multi-page application.

can.route is the core of CanJS's routing functionality. It is a special Observe that updates window.location.hash when its properties change and updates its properties when window.location.hash changes. You can give can.route a template to translate URLs into property values, but if no route is provided, it just serializes the route into standard URL-encoded notation.

link http://canjs.com/guides/Routing.html

25 questions
3
votes
2 answers

Location.hash returns empty string

I am currently using jQuery, Twitter Bootstrap and CanJS for my web application. I'm trying to implement routing with CanJS. I'm using Bootstrap's tab, and when I click on a tab, it was supposed to bring #tabSearch, #tabUser or #tabPermissions, but…
Glund
  • 507
  • 1
  • 5
  • 20
3
votes
1 answer

Defining two separate routers with can.Control.route in CanJS

I have two routes defined in different JS-documents, although both are included into the same HTML-file. Route 1 looks like this: Router = can.Control({ "invoices/:id route": function(data){ //load an invoice by id } }); And the other…
Anton Gildebrand
  • 3,641
  • 12
  • 50
  • 86
2
votes
1 answer

Canjs Not Routing

so this bug is killing me as I have no clue what's going on, I updated my canjs version to the latest which is currently 2.0.4 with jquery, and the router stopped working. Is not routing anything, I try with window.location.hash and can.route.attr…
rdk1992
  • 406
  • 1
  • 5
  • 20
2
votes
1 answer

CanJS multiple page app

The tutorials and example I've seen are all single page application. Can anyone give an idea or point to a resource showing how a multiple page app can be developed with CanJS?
Steve Ng
  • 1,189
  • 1
  • 13
  • 35
1
vote
2 answers

CanJS - Two way binding

How to do two-way binding using CanJS? Enter the Text : Display the Text: {{enteredText}} Can show multiple approaches? Using ViewModel ?
Santosh
  • 875
  • 5
  • 14
  • 33
1
vote
1 answer

Routing Conventions in Can.js

So I’m looking to make some routes within my super cool can.js application. Aiming for something like this… #!claims ClaimsController - lists claims #!claims/:id ClaimController - views a single claim #!claims/new ClaimController…
savinger
  • 6,544
  • 9
  • 40
  • 57
1
vote
1 answer

Button being called multiple times

I have a search page and an edit page. I search for a user and then when I get the results, I'm able to edit the user. I'm using CanJS and I've defined routes for each page. , 'search route': function (data) { new FormUserQuery('#formArea',…
Glund
  • 507
  • 1
  • 5
  • 20
1
vote
1 answer

Javascript framework canJs control.route

I would like use this tuto, but doesn't work for me $(function() { Router = can.Control({ "completed route" : function(){ console.log("the hash is #!completed") }, "active route" : function(){ …
Phane
  • 201
  • 3
  • 11
1
vote
3 answers

How do I listen for and react to a blank route using {can.route}?

I want to set up routing with CanJS so that depending on what url I hit, some corresponding control is set up. My problem is trying to find a way of expressing a default route to listen for in the control: "If none match, then do this". Any tips on…
oligofren
  • 20,744
  • 16
  • 93
  • 180
1
vote
1 answer

Can js delayed route matching / manually triggering the dispatch?

I have a control set up like this: Renders a view loaded async. Data for the view is also loaded asynchronously. Listens to route changes. One of the route handler displays a modal with the details of a model loaded in step 2. The problem is that…
Adrian Miu
  • 91
  • 1
  • 1
  • 4
1
vote
1 answer

How do I Implement router in CanJS

I am taking help of the https://github.com/thinkadoo/Projects application. I have built a similar app with the help of this one. My application is using d3 charts instead of the one this uses. My app initializes the routers as var patientStatus =…
Shraddha Shravagi
  • 1,096
  • 1
  • 9
  • 22
1
vote
2 answers

How to define a catch all route to handle 404 in can js?

What is the proper way to define a catch all route to handle 404 in can.js in a way that all the correct routes will be checked against first? If non are matched this route will catch it and I can display a 404 message.
a11hard
  • 1,904
  • 4
  • 19
  • 41
0
votes
1 answer

CanJS can.route.ready() version 2.1- '#!' is changed to '#!&' on clicking the link

I have an application which relies on can.route to capture the #change when the user clicks on a link. href for the link is having pattern '#!'. Once the change is capture by the can route utility, i am seeing the hash in the browser changing to…
0
votes
0 answers

CanJS URL decoding issue

I have routing handling with: 'route': function(data) { if (data.widget) return; this.handle_route(data); }, ':widget route': function(data) { if (data.sub) return; this.handle_route(data); }, ':widget/:sub route': function( data ) { if…
Mason Shin
  • 11
  • 4
0
votes
1 answer

Canjs routing components

How is routing with components done with canjs? I have following example can.Component.extend({ tag: "router", events: { "{can.route} id bla": function(route, event, id, bla) { console.log("route", id, bla); } } …
php--
  • 2,647
  • 4
  • 16
  • 18
1
2