- It is responsible to control the relation between models and views.
- It responds to user input and performs interactions on the data model objects.
- The controller receives input, validates it, and then performs business operations that modify the state of the data model.
- It is a JavaScript function.
- A controller is associated with a HTML element with the ng-controller directive.
In JS
 
Declaration Type #1
var myController = function(){
//Business logic
}
myApp.controller(“myController”, myController);
Declaration Type #2
myApp.controller(“myController”, function(){
Declaration Type #1
var myController = function(){
//Business logic
}
myApp.controller(“myController”, myController);
Declaration Type #2
myApp.controller(“myController”, function(){
                    //Business logic
                 });
In Html
<div ng-controller=‘myController’> </div>
 
No comments:
Post a Comment