I have a Backbone Router and six Backbone Views which load (depending on User’s settings) one of two templates. Yet, both templates use the same function, and I don’t want to repeat myself defining the function in both templates, or in the six Views. Instead, I would like to define it in the Router. I know how to pass a model in to a view and template. But, how can I pass my custom function through to the View and then to the templates so that it can be called in either of them?
Thanks
You could create a “super” view that all your other views extend.
Something like:
Both View1 and View2 will have
myReusableFunctionavailable.