requirejs.config({ paths: { 'text': '../Scripts/text', 'durandal': '../Scripts/durandal', 'plugins': '../Scripts/durandal/plugins' }, urlArgs: "bust=" + (new Date()).getTime() // TODO }); define('jquery', function () { return jQuery; }); define('knockout', ko); define(['durandal/app', 'durandal/viewLocator', 'durandal/system', 'services/antiforgery', 'services/authentication', 'plugins/router', 'plugins/dialog'], function (app, viewLocator, system, antiforgery, authentication, router, dialog) { app.title = 'Test'; //specify which plugins to install and their configuration app.configurePlugins({ router: true, dialog: true, widget: true }); //>>excludeStart("build", true); system.debug(true); //>>excludeEnd("build"); antiforgery.addAntiForgeryTokenToAjaxRequests(); authentication.handleUnauthorizedAjaxRequests(function () { dialog.showMessage('You are not authorized, please login') .then(function () { router.navigate('#/account/login'); }); }); app.start().then(function () { //Show the app by setting the root view model for our application with a transition. app.setRoot('shell'); }); });
define(['plugins/router', 'durandal/app'], function (router, app) { return { activate: function () { router.map([ { route: '', moduleId: 'home/index', title: 'Home' }, { route: 'account/login', moduleId: 'account/login', title: 'Login', nav: false }, { route: 'account/logoff', moduleId: 'account/logoff', title: 'Logoff', nav: false }, { route: 'tasks*details', moduleId: 'tasks/index', title: 'Tasks', nav: true, hash: '#tasks' } ]).buildNavigationModel(); return router .activate(); }, router: router } });
<div> <!--ko compose: { model: router.activeItem, view:'header.html', mode:'templated' }--> <!--/ko--> <div class="page-host"> <!--ko router: { cacheViews: false}--> <!--/ko--> </div> </div>
define(['plugins/router', 'durandal/system', 'services/authentication'], function (router, system, authentication) { return { router: router, title: 'Home', logoff: function () { console.log('logoff'); authentication.logoff(); router.navigate('#/account/login'); }, attached: function (view) { system.log('Lifecycle : attached : hello');And finally the index.html
// Using jQuery Mobile
$("div[data-role=page]").page("destroy").page(); } }; });
<ul data-role="listview" data-inset="true"> <li data-role="list-divider">Navigation</li> <li> <a data-bind="click: logoff">Logout</a> </li> <!-- ko foreach: router.navigationModel --> <li data-bind="css: { active: isActive }"> <a data-bind="attr: { href: hash }, html: title"></a> </li> <!-- /ko --> </ul>
--
You received this message because you are subscribed to the Google Groups "DurandalJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to durandaljs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I am curious if you have looked at the problem? :-)
-stian
--
You received this message because you are subscribed to the Google Groups "DurandalJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to durandaljs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
--
You received this message because you are subscribed to the Google Groups "DurandalJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to durandaljs+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
I definitely am in my viewmodels...
Much appreciated Rob!
I was starting to think that my code always had this issue and that the new verbosity level of 2.0.0 has just exposed it.
Ok...The fix is in branch Version-2.0.1. Just grab the latest version of router.js from there. Please let me know if your issues are resolved. Thank you.