I’m playing around a little with a Chaplin App and try to add a class to a link in my navigation depending on the routed URL.
# navigation_view.coffee
initialize: ->
super
@subscribeEvent '!router:changeURL', @setActiveNavigation
setActiveNavigation: (path) ->
$('nav a[href="/' + path + '"]').addClass "active"
That works pretty well for the fraction of a second until the whole navigationView is being rerendered. autoRender is set to false. Does anybody know how to prevent the view from being rerendered?
Thanks a lot
Never mind, I forgot about the
@subscribeEvent 'startupController', @renderand now without that it works fine.