hi lets get started with angular js
Angular js was built using the Javascript. It lets us extends Html with ng-directives i.e. ng-app, ng-model, ng-bind.
Lets see this below Example:
Lets see this below Example:
<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js”></script>
</head>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<script src=”http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js”></script>
</head>
<body>
<h4>Welcome to Angular JS Tutorials</h4>
<div ng-app=”myFirstApp” ng-controller=”nameController”>
Enter Name: <input type=”text” ng-model=”myName”><br>
Full Name: {{myName}}
Full Name: {{myName}}
</div>
<script>
angular.module(‘myFirstApp’, []).
controller(‘nameController’, function nameController($scope) {
$scope.myName = “XYZ”;
});
</script>
angular.module(‘myFirstApp’, []).
controller(‘nameController’, function nameController($scope) {
$scope.myName = “XYZ”;
});
</script>
</body>
</html>
</html>
Here in this example as soon as a new text is updated it gets updated below in the view , so basically it means that whenever there is any change in model it will automatically get reflected in view.
This is one the important features of AngularJS as it synchronizes data between model and view, which means two way data binding.
No comments:
Post a Comment