Let's say you had a template with a select
element like this:
<template name="hello">
<select class="fruit">
<option value="grapes">grapes</option>
<option value="strawberries">strawberries</option>
</select>
</template>
Then you could add a change
event which you could use to determine the route:
Template.hello.events({
'change .fruit': function (event) {
var value = $(event.target).val();
var routeName = routeNameFromFruit(value);
Router.go(routeName);
}
});
I'm assuming you are using iron-router, so Router.go
is available.
If you are using IR, you can manage your subscription changes with waitOn. If not then you can set a session variable and use a global autorun to start and stop your subscriptions.