HTML and CSS Reference
In-Depth Information
/**
* Return the controller
*/
return returnController;
},
/**
* Initializes all of the controllers. You might not want to do this
* automatically, so you can use the initScripts method to execute it.
*/
initScripts: function(){
_controller.movies = new app.controller.movies();
_controller.favorites = new app.controller.favorites();
_controller.favorites.list();
}
}
})();
The Movies Controller
The movies controller is quite complex, as it handles searching for movies
through the Rotten Tomatoes API, and providing a list of results as the user
types through JSONP.
First, start by creating a new controller within js/app/controller called
movies.js with the following code.
var app = app || {};
app.controller = app.controller || {};
app.controller.movies = function(){
this.init = function(){}
this.init();
}
All controllers contain an init method that is executed at the end of the object.
You will want to declare a few instance variables.
_searchfield -----contains the DOM element for the search field
_searchform -----contains the DOM element for the search form
 
Search WWH ::




Custom Search