I am trying to write a NopCommerce plugin. I have put in my app related files inside plugin's root directory in app
named directory. In my shell.js viewmodel
I define routes as follows:
define(['durandal/system', 'durandal/plugins/router', 'service/logger','config'],
function(system, router, logger,config) {
var shell = {
activate: activate,
router: router
};
function activate() {
logger.log('MyProducts Started', null, system.getModuleId(shell), true);
router.map([
{ route: '', moduleId: 'viewmodels/myProducts', title: 'My Products', nav: true },
{ route: 'searchProducts', moduleId: 'viewmodels/searchProduct', title: 'Search Products', nav: true },
{ route: 'addProducts', moduleId: 'viewmodels/addProduct', title: 'Add Product', nav: true }
]).buildNavigationModel();
return router.activate();
}
return shell;
}
);
Per conventions it should go to first route defined by module: viewmodels/myProducts
but I am getting following error:
[viewmodels/shell] MyProducts Started system.js:75
[main] No router found Object
Navigation Complete undefined Object
Uncaught TypeError: Cannot read property 'router' of undefined
I am banging my head with the well. It is not going to default route (with route:'').