- AngularJS - Internationalization
- AngularJS - Custom Directives
- AngularJS - Dependency Injection
- AngularJS - Services
- AngularJS - Scopes
- AngularJS - Views
- AngularJS - AJAX
- AngularJS - Includes
- AngularJS - Forms
- AngularJS - Modules
- AngularJS - HTML DOM
- AngularJS - Tables
- AngularJS - Filters
- AngularJS - Controllers
- AngularJS - Expressions
- AngularJS - Directives
- AngularJS - First Application
- AngularJS - MVC Architecture
- AngularJS - Environment Setup
- AngularJS - Overview
- AngularJS - Home
AngularJS Applications
- AngularJS - Lastfm Application
- AngularJS - Leaflet Application
- AngularJS - Timer Application
- AngularJS - Weather Application
- AngularJS - Share Application
- AngularJS - Maps Application
- AngularJS - Chart Application
- AngularJS - Translate Application
- AngularJS - Cart Application
- AngularJS - Drag Application
- AngularJS - Search Tab
- AngularJS - Order Form
- AngularJS - Switch Menu
- AngularJS - Nav Menu
- AngularJS - In-line Application
- AngularJS - Upload File
- AngularJS - Login Application
- AngularJS - Bootstrap Application
- AngularJS - Notepad Application
- AngularJS - ToDo Application
AngularJS Useful Resources
- AngularJS - Discussion
- AngularJS - Useful Resources
- AngularJS - Quick Guide
- AngularJS - Questions and Answers
Selected Reading
- Who is Who
- Computer Glossary
- HR Interview Questions
- Effective Resume Writing
- Questions and Answers
- UPSC IAS Exams Notes
AngularJS - First Apppcation
Before creating actual Hello World ! apppcation using AngularJS, let us see the parts of a AngularJS apppcation. An AngularJS apppcation consists of following three important parts −
ng-app − This directive defines and pnks an AngularJS apppcation to HTML.
ng-model − This directive binds the values of AngularJS apppcation data to HTML input controls.
ng-bind − This directive binds the AngularJS Apppcation data to HTML tags.
Creating AngularJS Apppcation
Step 1: Load framework
Being a pure JavaScript framework, it can be added using <Script> tag.
<script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.3.14/angular.min.js"> </script>
Step 2: Define AngularJS apppcation using ng-app directive
<span ng-app = ""> ... </span>
Step 3: Define a model name using ng-model directive
<p>Enter your Name: <input type = "text" ng-model = "name"></p>
Step 4: Bind the value of above model defined using ng-bind directive
<p>Hello <span ng-bind = "name"></span>!</p>
Executing AngularJS Apppcation
Use the above-mentioned three steps in an HTML page.
testAngularJS.htm
<html> <head> <title>AngularJS First Apppcation</title> </head> <body> <h1>Sample Apppcation</h1> <span ng-app = ""> <p>Enter your Name: <input type = "text" ng-model = "name"></p> <p>Hello <span ng-bind = "name"></span>!</p> </span> <script src = "https://ajax.googleapis.com/ajax/pbs/angularjs/1.3.14/angular.min.js"> </script> </body> </html>
Output
Open the file testAngularJS.htm in a web browser. Enter your name and see the result.
How AngularJS Integrates with HTML
The ng-app directive indicates the start of AngularJS apppcation.
The ng-model directive creates a model variable named name, which can be used with the HTML page and within the span having ng-app directive.
The ng-bind then uses the name model to be displayed in the HTML <span> tag whenever user enters input in the text box.
Closing</span> tag indicates the end of AngularJS apppcation.