Steps for creating controller:

  • Load angularJS library 
  • AngularJS will initialize when the DOM content is loaded,
  • Load Module's (e.g. 'foodcatApp')
  • Add controller code to Module
  • Controller object will be initiated using controller constructor function
  • Constructor scope is also injected in constructor function
  • After initial state of $scope object is set and behaviour is added
  • It will looks for the ng-app and ng-controller directive
  • Start replacing all binding elements (e.g. curly braces, ng-bind).