Angularjs Introduction

Now a day’s most of the users showing interest in single page applications, suddenly a doubt strikes in your mind, what is single page application (SPA)?
So let me explain in detail about single page apps, Google employee started the work on angularjs, idea turns very well and now Google officially providing support to angular js.

Angularjs uses mvc framework, mvc means (model, view and controller).
To develop Angular applications (spa) you need to have basic knowledge in
Now let me walk through features of angularjs

Data Binding: In Angularjs data binding plays a major important role, here data synchronization done automatically between model and view components.

Controllers: It is nothing but JavaScript constructor function, which is used to argument angular scope.

Services: There are two types of services
1. Lazily instantiated
2. Singletons
 If the component there in the application, then angular service will be initiated.
 Each and every component dependent on a service get reference to single instance is generated by a service factory.
Example service: $http
How to create a angular service?
First we need to create a JavaScript file name as app.js
Within the file write below code to create your first service.

Scopes: Scope is used to joining application controller and view, in template linking phase the directives set up expressions on the scope.
Example: Now I will display textbox value using scope.

READ  How to update form using Angularjs and codeigniter?

Now let’s see html code below

Dependency Injection :
Components get hold of their dependencies is known as dependency injection, angular injection subsystem creates components which resolve dependencies, and provides other components as requested.
Now let’s check small example below
Above we create a service to display textbox value, now we use injector how to build a service.

Now we will create a new injector that will provide components defined in our myfirstservice, and request the uservalue service from the injector.

Angularjs directive template function example next feature.

Thanks for reading this article.

READ  Data Binding in AngularJS

Leave a Reply