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

Re : Re: Data-Driven Javascript Controls -- What about checking checkboxes?

$
0
0
Hey @spautz I think you made a reasonable choice, but personally I think it's always best that a control has it's own ViewModel even if it only contains the model passed in. That frees you to add control-specific properties that you need like in this case. There's no real overhead to doing this. Doing it the way you are is fine right now but if you start to add more listeners it can turn into spaghetti code rather quickly (I've done this before myself).

If you're thinking about using can.Component in the future (or present) it strongly favors a template-driven style over event listeners, so it's a good idea to start thinking in that way now.

Viewing all articles
Browse latest Browse all 3491

Trending Articles