Angular controllers control the data flow in application. Controller is defined by ng-controller.
We define all script, function in the controller, every controller have their scope which works as parameter and that controller is applied on their $scope.
Below is an Example of controller -
HTML -
<div ng-controller="firstController">
...
</div>
Script -
sampleApp.controller('firstController', function($scope) {
$scope.message = 'This message for controller;
});
0 Comment(s)