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

Re : best way to implement common Model.List

$
0
0
You should have one main app module (file), you may implement it as can.Control. There you should create a model that you plan to share between controls, and then pass it as an option to both of you controls while you initialize them.

There many reasons why using globals in JS is bad. Ask google and stackoverflow (http://c2.com/cgi/wiki?GlobalVariablesAreBad )


I encourage you to use AMD approach to build modular apps (using steal,js or require.js), this will save you from the need of using globals.

Viewing all articles
Browse latest Browse all 3491

Trending Articles