How can I passa viewModel or Scope property into a stache helper?

I have a stache helper in scope on a template that swaps out views when called on a can-click listener. The click binding looks like this:

<li can-click="switchView 'listView'"></li>

How can I pass a viewModel or scope property into the helper? The only arguments that seem to get passed into the helper as parameters are strings. I’d like to do this to send along any relevant data for the next view.

I’d like to do this:

<li can-click="switchView 'listView' ."></li>

But when I do, I get this:

switchView: function (viewName, obj) {
    // ['listView']

Any ideas? I must be misunderstanding something.


Hi Alex,

I don’t know if you’ve managed to get sorted but have you taken a look at this:

Seems as though %viewModel may do the trick. Also, the binding syntax ( has been changed somewhat but I guess that would depend on your version of canjs.