Here we have “Customer” controller which provides data via “CustomerName” and “CustomerCode” property and Add/ Update logic to save the data to database.
“Controllers” are simple javascript function which provides data and logic to HTML UI. As the name says controller they control how data flows from the server to HTML UI.
function Employee($scope) { $scope.FirstName = "Anupam"; $scope.EmployeeCode = "1001"; $scope.Add = function () { } $scope.Update = function () { } }
“ng-controller” is a directive.Controllers are attached to the HTML UI by using the “ng-controller” directive tag and the properties of the controller are attached by using “ng-model” directive. For example below is a simple HTML UI which is attached to the “Employee” controller via the “ng-controller” directive and the properties are binded using “ng-model” directive.
How to use ng-controller and ng-model in Angular JS?
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy
Join MindStick Community
You have need login or register for voting of answers or question.
Manoj Bhatt
24-Feb-2016