What is a controller in Angular JS?
Question :
What is a controller in Angular JS?
A controller is a JavaScript function which is bound to the specified scope. Angular instantiates the new controller injects the new scope as a dependency. It can be used to set up the initial state of the scope object and to add behavior to the object. It cannot be to share code or state across controllers, but instead of that Angular service can be used.
Example,
<Any ng-Controller=" expression">
</Any>
<div ng-app="mainApp" ng-controller="SimpleController">
</div>