Angular JS

Overview:
 
AngularJS has become one of the most popular javascript framework. It is widely used by web developers, enterprises like Facebook, Paypal, etc. Angular is in fact maintained by Google Inc. AngularJS has very steep learning curve because of its concepts like Modules, Dependency injection, Two-way data binding, Services, etc.

Pre-requisites:

Knowledge of HTML, Javascript & basics of jQuery. Additionally, HTTP Verbs, Ajax/HTTP Request, JSON would be more advantageous.

Concepts Brief:

Modules:

A Module is considered as a container of different components such as controllers, services, directives, filter, etc of your app. Angular JS application should have atleast one module in it.

Example, if you are building an web application with AngularJS like Flipkart then it can be organized by putting all code for products in 'Product' module or code for cart in 'Cart' module.

Controller:
A controller is nothing but a sub container of functionalities/action within a module.

Example, (building an web application with AngularJS like Flipkart): Code for managing products, product list will be placed in 'ProductController'. Then code for adding product to Cart will be placed in 'CartController'.

'$scope' is one of most important object for controller, it contains all the data for the controller. Every controller has its own scope and it cannot be shared with another controller. In case if we need to share the data across controllers we can use '$rootScope' object.

Dependency:

When creating a controller we need to specify the dependency required for it. Dependency are nothing but the object required by controller.

Example, if we need to use '$scope' in controller then we need to specify it as dependency to controller. Then we can access the data in '$scope' within the controller.

Directives:

AngularJS has some in-built directives such as ngBind, ngClass, etc. Directives are nothing but an extension to HTML Elements or DOM Elements which tells the HTML Compiler of AngularJS to attach the specified behavior with it. You can also define your custom directive with AngularJS.

Example, ngClick - ngClick is an in-built directive, which tell AngularJS's HTML compiler to attach the click event of the element.


NOTE: Please hold on until we get more description of other components with code examples.

 

Boston Byte Grabs a Spot in Clutch’s List of Top Software Developers in Massachusetts

Boston Byte is a collective of highly-skilled and highly-professional developers dedicated to solving your technological ...