Maybe if I post some code, it'll make more sense to you guys?
/app/init.js:
- require.config({paths:
- {
- can: "libs/canjs-2.0.3/amd/can/",
- jquery: "libs/jquery-2.0.3"
- }});
- require(["app","can/route/pushstate"], function(app)
- {
- can.route.bindings.pushstate.root = "/app/";
- new app( $(".app") );
- });
- define(["can/control"], function()
- {
- return can.Control.extend(
- {
- init: function(element, options)
- {
- element.html( can.view("templates/app.mustache", {}) );
- can.route(":section");
- can.route.ready();
- can.route.attr("section", ""); // test root (fails)
- },
- ":section route": function(data)
- {
- console.log(":section route");
- // instantiate other components here
- },
- "route": function(data)
- {
- console.log("route");
- // instantiate "homepage" component here
- }
- });
- });