Quantcast
Channel: JavaScriptMVC Forum
Viewing all articles
Browse latest Browse all 3491

Re : Passing a callback to a component - possible?

$
0
0
http://jsbin.com/koxobamo/11/edit

They can be decoupled for the sake of demonstrating it via special events and can-event. Though if this were a real component I would have "x-chooser" handle the rendering of the list too. I must say I dislike that arguments must be part of the event object, I'd prefer to use `elm.trigger('selected', val)` but the extra argument is not passed along to the handler.

Another way you could do it is to use "<content></content>" in "x-list" to customise how each row is rendered:

<script type="text/stache" id="x-chooser">
   <x-list>
      <a href="javascript:;" can-click="chooseItem">{{name}}</a>
   </x-list>
</script>



Viewing all articles
Browse latest Browse all 3491

Trending Articles