Creating an interactive component demo page

I have the following demo page (created with donejs):

<script type="text/stache" can-autorender id="log-template">
  	<can-import from="menuboard-manager/utils/logger/" />
  	<mbm-log></mbm-log>
</script>
<script src="../../../node_modules/steal/steal.js"
        main="can/view/autorender/">
</script>

Now if I run the following from the console, it works fine:

 var lvm = $('mbm-log').viewModel();
 lvm.toggle();
 lvm.toggleView();
 lvm.log('Hello');

How can I embed this and other calls to my component’s viewModel in the page itself either as a script or bound to buttons and other input/output widgets?

I tried putting it in the steal script (with imports from jquery and my component) but it seems that the viewModel is not yet bound to the component when the steal script runs, so the viewModel is empty and I can’t run any of my methods. If I try it in it’s own script tag, then it doesn’t have access to jquery.

I tried looking at bitballs for an example, but most of the code there is still using the old syntax and seems to be creating a template on the fly and injecting it into a div. But I already have the template created thanks to the donejs generator, but no handle to the viewModel.

thanks,
Dovid

I am not sure exactly what you are looking for, but if the buttons can be in the #log-template, you could do this for example:

<!-- export the component's viewmodel to the references scope (1-way bound) -->
<mbm-log {^.}="*lvm"></mbm-log>
<input type="button" value="Toggle" ($click)="*lvm.toggle()">
<input type="button" value="ToggleView" ($click)="*lvm.toggleView()">
<input type="button" value="Log" ($click)="*lvm.log('Hello')">

@DylanRoss, thanks! That is exactly what I was looking for.