AngularJS Introduction
AngularJS is aJavaScript framework. It can be added to an HTML page via a <script> tag.
AngularJS throughdirectivesextends HTML, and throughexpressionsbinds data to HTML.
AngularJS is a JavaScript framework
AngularJS is a JavaScript framework. It is a library written in JavaScript.
AngularJS is distributed as a JavaScript file, and can be added to a web page using a script tag:
![]() |
We recommend placing the script at the bottom of the <body> element. This improves web page loading speed because HTML loading is not subject to script loading. |
|---|
Downloads for various angular.js versions:https://github.com/angular/angular.js/releases
AngularJS extends HTML
AngularJS throughng-directivesextends HTML.
ng-appDirectives define an AngularJS application.
ng-modelDirectives bind element values (such as input field values) to the application.
ng-bindDirectives bind application data to the HTML view.
AngularJS Examples
Try it yourself »
Example explanation:
When the web page has finished loading, AngularJS starts automatically.
ng-appThe directive tells AngularJS that the <div> element is the AngularJSapplication's "owner".
ng-modelThe directive binds the value of the input field to the application variablename。
ng-bindThe directive binds the application variable name to the innerHTML of a paragraph.
![]() |
If you remove theng-appdirective, HTML will display the expression directly without evaluating the result of the expression. |
|---|
What is AngularJS?
AngularJS makes it easier to develop modern single-page applications (SPAs: Single Page Applications).
- AngularJS binds application data to HTML elements.
- AngularJS can clone and repeat HTML elements.
- AngularJS can hide and show HTML elements.
- AngularJS can add code "behind" HTML elements.
- AngularJS supports input validation.
AngularJS Directives
As you can see, AngularJS directives arengHTML attributes with a prefix.
ng-initThe directive initializes AngularJS application variables.
AngularJS Example
Try it yourself »
![]() |
HTML5 allows extended (custom) attributes, usingdata-as the beginning. AngularJS attributes useng-as the beginning, but you can usedata-ng-to make the web page valid for HTML5. |
|---|
With valid HTML5:
AngularJS Example
Try it Yourself »
AngularJS Expressions
AngularJS expressions are written inside double braces:{{ expression }}。
AngularJS expressions bind data to HTML, which isng-bindsimilar to directives.
AngularJS will "output" data where the expression is written.
AngularJS Expressionsare very similar toJavaScript expressions: They can contain literals, operators, and variables.
Example: {{ 5 + 5 }} or {{ firstName + " " + lastName }}
AngularJS Example
Try it Yourself »
AngularJS Applications
AngularJS ModuleDefines the AngularJS application.
AngularJS ControllerIs used to control the AngularJS application.
ng-appDirectives define the application,ng-controllerdefine the controller.
AngularJS Example
Try it Yourself »
AngularJS modules define applications:
AngularJS Modules
AngularJS controllers control applications:
AngularJS Controllers
In the upcoming tutorials, you will learn more about applications and modules.
Other Extensions


