I've 4 views (templates):
I defined routing in client_server/lib/routing.js:
Router.configure({
loadingTemplate: 'loading'
});
Router.route('/', {
name:'start',
template:'start'
});
Router.route('/mobile', {
name:'mobileStart',
template:'showScannedData'
});
Router.route('/desktop', {
name:'desktopStart',
template:'dashboard'
});
In client/app.js I put:
Router.go('/start');
It works. However the template showScannedData is rendered twice, as if I set it as templateLayout too. As for my application I don't need a default layout but single individuals view to be loaded either on start (template: start) or on a specific action performed by the user (templates: showScannedData / dashboard).
What am I doing wrongly?
Thanks to @piscator and @Keith for giving me a key hint.
I figure out that, while I wasn't rendering the template twice, I put
{{>> showScannedData}}
in project_name.html file (i.e. the file rendered when routing is not used).
So I basically removed the line above from the file and used Iron's router to go to starter template by:
Router.go("/")
in client/app.js, which is defined in client_server/lib/routing.js as
Router.route('/', {
name:'start',
template:'start'
});
corresponding to
<template name="start">
<input id="goToMobileBtn" type="button" value="Go to mobile view"/><br><br>
<input id="goToDesktopBtn" type="button" value="Go to desktop view"/>
</template>
Hint: I found out that since "/" route is the first one defined in routing.js, the Router.go is optional.