AngularJS modules define AngularJS
applications.
Example 1:
AngularJS Module
AngularJS Controller
AngularJS controllers control AngularJS
applications.
The ng-app directive defines the
application, the ng-controller directive
defines the controller.
Example 1:
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<div ng-app="myApp"
ng-controller="myCtrl">
<p>Enter two number:</p>
<p>a value: <input
type="number" ng-model="a"></p>
<p>b value: <input
type="number" ng-model="b"></p>
<p>{{(a+b)}}</p>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.a= 10;
$scope.b= 15;
});
</script>
</body>
</html>
Example 2:
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>
<body>
<p>Change
your name by typing</p>
<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= "suryosnata";
$scope.lastName= "Behera";
});
</script>
</body>
</html>
Notes:
AngularJS modules define applications:
AngularJS Module
var app =
angular.module('myApp', []);
AngularJS controllers control
applications:
AngularJS Controller
app.controller('myCtrl',
function($scope) {
$scope.firstName= "suryosnata";
$scope.lastName= "Behera";
});
$scope.firstName= "suryosnata";
$scope.lastName= "Behera";
});
Python is an open-source, high level, interpreted programming language which offers great opportunities for object-oriented programming. Choosing a python training program from Red Prism Group, which is best training institute for python in noida.
ReplyDelete