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

Re : AppSwitcher Control

$
0
0
@Mohamed, I have used the controller/action architecture in a full fledged enterprise application and it is very elegant and pleasant to maintain/extend. The trick is to organize your logic in several utility modules (such as the ones I have in the "scripts/utils" folder: alert, form, helpers, tooltip, etc) and to use a base class for your controllers. I use the base controller class called "scripts/utils/basecontrol.js" to handle the page transitions and even model popups, so my derived controllers can change pages or trigger a modal popup simply by calling the base controller actions with options like this:

  1. this.view({
  2.   url: 'views/pages/index.html',
  3.   selector: '#main_container',
  4.   fade: false,
  5.   fnLoad: function(el) {
  6.     $('.tweets', el).relatedTweets({
  7.       query: '#javascript',
  8.       n: 50
  9.     });
  10.   }
  11. }); 
@thecountofzero, thanks for all the contributions! It helped me get up to speed with CanJS. PS -- I didn't mean to take over the thread but was in the spirit of code evolution :)

Viewing all articles
Browse latest Browse all 3491

Trending Articles