http://canjs.com/docs/can.route.html
3 common ways I do it
can.Control({
"{can.route} change": function(ev, attr, how, newVal, oldVal) {
if (attr === "type") {
this.element.find('div.show-hide').toggle()
}
}
})
or
"{can.route} type change":function(){
this.element.find('div.show-hide').toggle()
}
or in init or some other function:
can.route.bind('change', function(ev, attr, how, newVal, oldVal){
this.element.find('div.show-hide').toggle()
})
3 common ways I do it
can.Control({
"{can.route} change": function(ev, attr, how, newVal, oldVal) {
if (attr === "type") {
this.element.find('div.show-hide').toggle()
}
}
})
or
"{can.route} type change":function(){
this.element.find('div.show-hide').toggle()
}
or in init or some other function:
can.route.bind('change', function(ev, attr, how, newVal, oldVal){
this.element.find('div.show-hide').toggle()
})