Follow by Email

Friday, December 5, 2014

Getting started with AngularJS

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:
<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}}
</div>
<script>
angular.module(‘myFirstApp’, []).
controller(‘nameController’, function nameController($scope) {
$scope.myName = “XYZ”;
});
</script>
</body>
</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.
1

This is one the important features of AngularJS as it synchronizes data between model and view, which means two way data binding.