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

Re : Passing a callback to a component - possible?

$
0
0
Not really,  will explain why

"List should not have to know about the methods in Chooser."

Doing so:
<list on-selected="onSelect" name="Good list">

you are instantiating new component and via on-select and name you are passing some particular parameters to a particular component instance. List component definition itself knows nothing about onSelect method and nothing about parent components (it doesn't know about existence of Chooser component and doesn't require it). But it requires (or has it as option) supplying some can-event callback (which is a method in any parent scope and may have any name) using which it will notify about item choice.

Viewing all articles
Browse latest Browse all 3491

Trending Articles