Hello World – AngularJS (Part 1)



AngularJS is a JavaScript Framework which is developed by Google.

Some basic concepts :
1. The main benefit of angularJS is (I Think) we can declare variable in html part.
2. Declared variable should be within two curly braces.

Some basic concepts for this example :
1. To run AngularJS we have to add “ng-app” attribute to the <html> tag.
2. Add below AngularJS reference into <head> tag:
    <script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js“></script>


3. Add ng-model for any input field.

Hello World :

<html ng-app>
<head>
<title>Hello World</title>
<script type=”text/javascript” src=”//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.min.js“></script>

</head>
<body>
<input type=”text” ng-model=”someVariable”/>
<p>{{someVariable}}</p>
</body>
</html>

Output :
If we run this code then we can see an input tag.
Whatever we write in this tag we can see that text in <p> tag.

Leave a Reply