AngularJS Controller
AngularJS applications are controlled by controllers. A controller is a JavaScript Object, which is created by a standard JavaScript object called constructor. In below example lastName and firstName are two properties of controller object demonstrated below.
- <div ng-app="myApp" ng-controller="myCtrl">
- First Name: <input type="text" ng-model="firstName"><br>
- Last Name: <input type="text" ng-model="lastName"><br>
- <br>
- Full Name: {{firstName + " " + lastName}}
- div>
- <script>
- var app = angular.module('myApp', []);
- app.controller('myCtrl', function($scope) {
- $scope.firstName = "Raj";
- $scope.lastName = "shekhar";
- });
- script>
Reference
http://www.w3schools.com/angular/angular_controllers.asp
To read such more blogs on AngularJS please visit our AngularJS Blogs Section.
Advertise on APSense
This advertising space is available.
Post Your Ad Here
Post Your Ad Here
Comments