An Introduction to AngularJS

Here is an introduction to AngularJS

  • AngularJS is a JavaScript framework.
  • AngularJS follows the architecture of MVC (Design pattern).
  • In general, JavaScript is strongly associated with HTML elements while performing the manipulations to DOM. To overcome this, AngularJS allows us to create our own elements or attributes (Directives or expressions as per AngularJS).
  • AngularJS also supports creating a Single Page Application. Single Page Application means loading different views into a single page without reloading all the time.
  • AngularJS will enhance the HTML elements by providing some new attributes or expressions.
  • Even though the angular elements are associated with HTML elements, the browsers will ignore the angular elements, whereas our angular instance will process these angular elements.
  • To build an AngularJS app, we need to configure it or refer to the built-in script file(.js). This file can accessed from the following URL: AngularJS official website
  • On the home page of that page itself, we can have the download button, where we can have the script file and in addition to it, we can find the CDN too.

CDN

Angular js

Adding reference of .js file to app.

Code

How to make our app an AngularJS app?

In a . HTML page if we want a certain part of the code to behave as AngularJS, then that part of the directive should be decorated or extended with ng-app = "".

HTML page

HTML

Body

From the above snaps, we know that the ng-app directive can be placed in any section or at any level of the HTML tags.

Now, here we may have a small question such as, "How many ng-app can be declared in a page ?". Here the answer will be any number. There is no rule that should have only one ng-app.

The perfect and popular definition about ng-app is,

"ng-app is the root element of an AngularJS application, under which directives can be used to declare bindings and define behavior."

Read more articles on AngularJS.