AngularJS Introduction

 

 

What is AngularJS?

AngularJS is an open source JavaScript MVC web application framework.

AngularJS is a structural framework for dynamic web apps. It lets you use HTML as your template language and lets you extend HTML’s syntax to express your application’s components clearly and succinctly. Angular’s data binding and dependency injection eliminate much of the code you currently have to write. And it all happens within the browser, making it an ideal partner with any server technology.

It was originally developed in 2009 by Misko Hevery and Adam Abrons.

It is now maintained by Google.


Why AngularJS?

AngularJS is a MVC framework that defines numerous concepts to properly organize your web application.Your application is defined with modules that can depend from one to the others.

It enhances HTML by attaching directives to your pages with new attributes or tags and expressions in order to define very powerful templates directly in your HTML.

It also encapsulates the behavior of your application in controllers which are instanciated thanks to dependency injection.

Thanks to the use of dependency injection, AngularJS helps you structure and test your Javascript code very easily. Finally, utility code can easily be factorized into services that can be injected in your controllers. Now let’s have a closer look at all those features.


Features

  • AngularJS is a powerful JavaScript based development framework to create RICH Internet Application(RIA).
  • AngulajJS provides developers options to write client side application (using JavaScript) in a clean MVC(Model View Controller) way.
  • Application written in AngularJS is cross-browser compliant. AngularJS automatically handles javascript code suitable for each browser.
  • AngularJS is open source, completely free, and used by thousands of developers around the world. It is licensed under the Apache License version 2.0.

 


Core Features

Following are most important core features of AngularJS:

  • Data-binding: It is the automatic synchronization of data between model and view components.
  • Scope: These are objects that refer to the model. They act as a glue between controller and view.
  • Controller: These are Javascript functions that are bound to a particular scope.
  • Services: AngularJS come with several built-in services for example $http to make a XMLHttpRequests. These are singleton objects which are instantiated only once in app.
  • Filters: These select a subset of items from an array and returns a new array.
  • Directives: Directives are markers on DOM elements (such as elements, attributes, css, and more). These can be used to create custom HTML tags that serve as new, custom widgets. AngularJS has built-in directives (ngBind, ngModel…)
  • Templates:These are the rendered view with information from the controller and model. These can be a single file (like index.html) or multiple views in one page using “partials”.
  • Routing: It is concept of switching views.
  • Model View Whatever: MVC is a design pattern for dividing an application into different parts (called Model, View and Controller), each with distinct responsibilities. AngularJS does not implement MVC in the traditional sense, but rather something closer to MVVM (Model-View-ViewModel). The Angular JS team refers it humorously as Model View Whatever.
  • Deep Linking: Deep linking allows you to encode the state of application in the URL so that it can be bookmarked. The application can then be restored from the URL to the same state.
  • Dependency Injection: AngularJS has a built-in dependency injection subsystem that helps the developer by making the application easier to develop, understand, and test.

AngularJS Directives

The AngularJS framework can be divided into three major parts:

1. ng-app : This directive defines and links an AngularJS application to HTML.

2. ng-model : This directive binds the values of AngularJS application data to HTML input controls.

3. ng-bind : This directive binds the AngularJS application data to HTML tags.


Advantages of AngularJS

The advantages of AngularJS are:

  • It provides the capability to create Single Page Application in a very clean and maintainable way.
  • It provides data binding capability to HTML. Thus, it gives user a rich and responsive experience.
  • AngularJS code is unit testable.
  • AngularJS uses dependency injection and make use of separation of concerns.
  • AngularJS provides reusable components.
  • With AngularJS, the developers can achieve more functionality with short code.
  • In AngularJS, views are pure html pages, and controllers written in JavaScript do the business processing.

On the top of everything, AngularJS applications can run on all major browsers and smart phones, including Android and iOS based phones/tablets.


Disadvantages of AngularJS

Though AngularJS comes with a lot of merits, here are some points of concern:

1. Not secure : Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure.

2. Not degradable: If the user of your application disables JavaScript, then nothing would be visible, except the basic page.


 

One thought on “AngularJS Introduction

Leave a comment