AngularJS Controller
by Sumeet Arora CTO,Evon TechnologiesAngularJS 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.
Sponsor Ads
Created on Dec 31st 1969 18:00. Viewed 0 times.
Comments
No comment, be the first to comment.