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
0
votes
1 answer

Canjs: multiple pages inside one html

What is the recommended approach to navigate between pages inside single html. for example there are placeholders for list page(#listId) content and for details page (#detailsId) content. Should we use jquery show/hide to #listId or #detailsId with…
Natallia
  • 157
  • 1
  • 9
0
votes
1 answer

Specific canjs route isn't called on page load with hashtag

What is wrong in the code? expected results: when the page loads like url/case#!open-cases or url/cases#!new then the target route listner('new route' or ':filter-cases route') should be called but it doesn't happen PageControl = can.Control({ …
Natallia
  • 157
  • 1
  • 9
0
votes
1 answer

Multiple Page Application Using CanJS

I am looking for a way to navigate from one html page to another html page in CanJS. Below is the scenario: index.html contains a login form (build using ejs) with forgot password link. index.html
control.js var…
Ankur Aggarwal
  • 2,993
  • 5
  • 30
  • 56
0
votes
1 answer

Authentication and Navigation in CanJs

What will be the best way to render the home page (after authentication). Let's say it have a leftNav and Content. Can we have these sections in login.html and initialize their controllers once authentication was cleared ? Is it best practice to…
Moove
  • 9
  • 3
0
votes
1 answer

canjs can.route and can.route.delegate, listen when property has a particular value?

I use canJs with plugin can.Map.delegate and i would like this, but it doesn't work, "ok" is not displaying in console. Could you help me ? $(function() { var Routing = can.Control({ '{can.route} id=3': function(data) { …
Phane
  • 201
  • 3
  • 11
0
votes
1 answer

How to set default params in can.Control.route

When using the can.Control.route documented here, I can not manage to set default parameters values as it is possible when using the classical declarative way as follow : can.route("content/:type", {type: "videos" }); Is there a way to set the…
Thomas
  • 1,410
  • 10
  • 24
0
votes
1 answer

Routing in canjs

right now im diving into canjs, it looks like a great mvc framework. I'm having troubles with the router. I'm using wamp for making my tests in localhost. So the problem is the following: when I enter localhost the initial url in the browser is…
rdk1992
  • 406
  • 1
  • 5
  • 20
0
votes
2 answers

can.routing : triggering a change to go from #!/foo/bar to #!/foo

I am trying to understand CanJS' routing. So far, I have the following routes set up. can.route('plant/:plant/', { plant : undefined, day : undefined }); can.route('plant/:plant/day/:day', { plant : undefined, day : undefined }); I…
oligofren
  • 20,744
  • 16
  • 93
  • 180
0
votes
1 answer

Canjs: trigger a route event for the current page

I have a can.Control that looks like this: can.Control({ "route": function(){ ... }, "a.test click": function(){ can.route.attr({ page: "home", type: "test" }); } }); "route" callback…
0
votes
1 answer

CanJS url changed back to #! when can.route.ready(true) executed

Code is here: http://jsfiddle.net/cTpPx/, but view the live example here http://fiddle.jshell.net/cTpPx/show/, because I want you to observe the url changes. Please disable Chrome cache when visit this page (Tick the relevant box in the built in…
user469652
  • 48,855
  • 59
  • 128
  • 165
1
2