This is probably a simple one..
I am trying to override the routers guardRoute function and it seems that my version is not being called.
Code
app.start().then(function () {
router.useConvention();
viewLocator.useConvention();
app.setRoot('viewmodels/shell', 'entrance');
router.handleInvalidRoute = function (route, params) {
logger.logError('No route found', route, 'main', true);
};
router.guardRoute = function (routeInfo, params, instance) {
logger.logError('guardRoute called', routeInfo, 'main', true);
return false;
};
});
Edit 1 - Entire main.js file shown
require.config({
paths: { "text": "durandal/amd/text" }
});
define(function (require) {
var system = require('durandal/system'),
app = require('durandal/app'),
router = require('durandal/plugins/router'),
viewLocator = require('durandal/viewLocator'),
logger = require('services/logger');
system.debug(true);
app.title = "my app";
app.start().then(function () {
router.useConvention();
viewLocator.useConvention();
app.setRoot('viewmodels/shell', 'entrance');
router.handleInvalidRoute = function (route, params) {
logger.logError('No route found', route, 'main', true);
};
router.guardRoute = function (routeInfo, params, instance) {
logger.logError('guardRoute called', routeInfo, 'main', true);
//return false;
};
});
});
I do not get my log message and the router continues to process the request. What am I doing wrong?