What is controller in AngularJS
When a Controller is attached to the DOM via the ng-controller directive, Angular will instantiate a new Controller object, using the specified Controller's constructor function. A new child scope will be created and made available as an injectable parameter to the Controller's constructor function as
If the controller has been attached using the
controller as syntax then the controller instance will be assigned to a property on the new scope.