I have just started playing with KnockoutJS and it it fascinating. I successfully created some templates to render two panels of an interface with \"ul\" nested menus inside.
Your issue is that your variable viewModel is defined in the jQuery ready function, so the functions in your data-binds can't see it, since it is not at the global scope. Even, doing a var viewModel = {}
outside the $(function() { ... });
would work.
The way that you defined your click function looks good to me. Your visible logic though should use viewModel.menuActive()
and viewModel.currentMenu()
to access the values as they are in an expression.
Hope this helps. Would be happy to help further, if you get stuck.