What Is Angularjs? Uses | Key Feature | Pure Coders
By: Pure Coders
Tags: Angularjs, Framework, Angular, Purecoders, Javascript Frameworks

AngularJS is a JavaScript Framework, which is used to build a web application. Google has developed AngularJS.AngularJS is an open-source project ie. it can be downloaded, used, and changed by anyone as per the requirement AngularJS provides an excellent platform for

creating a Single Page Application(SPA). An example of a Single Page Application is GMAIL.

Key features of AngularJS

SPA

SPA- stands for Single Page Application. SPA allows different views to be loaded into a shell page as the user interacts with the page. SPA maintains a history of views that have been displayed so if you will click on the back button it will go back to the previous view. Normally when you click on the back button, you will be going back to the previous website.

Two-way Data-Binding

Two-way Data binding always keeps the model and view updated at the same time. If there is any change in the model, it updates the view. Similarly, when the view has any changes, it updates the model respectively.

Dependency Injection

Dependency Injection is a software design pattern that deals with how objects and functions get created and how they get a hold of their dependencies. Everything with Angular(directive, filters, controller, services)is created and wired using Dependency Injection

Directives

Directives are the most important component of any AngularJS application. There are many

directives available in AngularJS Directives are the markers on the DOM element which attach special behavior to it.

Testing

AngularJS shines in Testing and this is where AngularJS has the upper hand. With AngularJS unit testing and end-to-end testing has become easier.

The key player in AngularJS

we can organize different parts to actually make a full application. So when you look at different parts in the big picture view it will look something like this: So on the very top, we have something called Modules.

Modules act like container that is used to hold components that you will create like controllers, directives, filters, services, and factories.

It also has routes, this is how we will define which view we need to load. Route is actually

a path that you see in the browser.

After route, there are two categories in which you can divide this big picture some data to have some logic. So on the UI side, we have viewed and in view, we can have directive-which enhance HTML and we can have a filter, the filter provides some data filtration functionality and on the logic/data side we can have controllers- it acts as a brain for our view and controller can have data from factories and services.

Now once we have data in the controller we need to pass this data to view. and we do

it by using $scope here $scope act like a ViewModel that provides data to my view. as of now you can think it like a glue between controller and view.

Directives in AngularJS

Directives are the most important components of any angularjs application according to angular documentation directives are a way to teach HTML new tricks essentially directives give HTML new functionalities you can also say directives are the markers on Rome element they tell angular HTML compiler to attach a specify be hey view to that Dom element.

Now you can think of directive as a little blog they can put together to perform a lot of

different operations and to build an application they can do all kind of things like no manipulation data binding we can refer our controllers and modules using directives handling events modify CSS and even you can decide where the view will load into the shell page so there are a lot of different things you can do with directives and I have just mentioned some key areas where we use directives there are a lot of built-in directives and angle ages and to make it easier for you I have divided few directives according to the categories.

Modules/Controllers Forms DOM manipulation Events Binding

Why use for angularjs?

Angularjs is a javascript framework for a dynamic web application.

Angularjs is widely used for SPA(single page application) like Gmail.

HTML templates

MVC patterns

DOM Elements

Data binding

Testing

Dependency Injection

The first thing is that unlike other frameworks which implement MVC that is model-view-controller by asking you to split your app into MVC components then require you to write code to string the pup together again like if you have been through frameworks like cake PHP and zen think like that

the PHP perspective server-side perspective you must have seen that we have to create folders with specific names like views then we have controllers and so on. that’s basically a lot of work and over here that angular js is a template means MVC by asking you to split your app into MVC components so you are free to define what exactly what folder will have the

views what folder will have the controllers and so on and so for so that way it puts you at ease to define your application angular js in this case just acts as the mediator.

The data models that we define in angularjs are plain old JavaScript object and they do not require extraneous functions you can add and change properties directly on it and loop over objects and arrays at will next is we have a behavior with directed our directives and angularjs are the way of bringing additional functionality to HTML.

Directives then come the filters that we have now with filters we can filter and sort data on the client-side itself so filters basically filter the data before they reach the view and can involve something as simple as formatting decimal places like formatting prices currency reversing the order of an array or just sorting it in a way so for that reason the flexibility that we get with filters

we should be making use of angularjs and then because angularjs provide a declarative approach of coding we have to write less code and then we also don’t have to manipulate Dom too much if you have the seen jQuery we tend to do a lot of Dom manipulations by making use of jQuery but with angularjs you won’t be even writing a single line of JavaScript code and you still will be doing ran angularjs is concerned so it just hides

the Dom manipulations for most of the scenarios you can definitely do Dom manipulations if required but most of the things can be easily handled by angularjs itself so these were some of the reasons for which I think you should be making use of angularjs.

More Articles: Tap

Follow us on instagram: Click here