Friday, 6 May 2016


What is Angular JS

AngularJS is a JavaScript framework that helps build applications that run in a web browser.

Who developed AngularJS

Google is the company that developed AngularJS. AngularJS is an open source project, which means it can be be freely used, changed, and shared by anyone.
AngularJS is an excellent framework for building both Single Page Applications (SPA) and Line of Business Applications. Many companies are using Angular today, and there are many public facing web sites that are built with angular.

What are the benefits of using AngularJS

1. Dependency Injection : Dependency Injection is something AngularJS does quite well. If you are new to Dependency Injection,It is just Like passing a method into another operation.
2. Two Way Data-Binding :One of the most useful feature in AngularJS is the Two Way Data-Binding. The Two Way Data-Binding, keeps the model and the view in sync at all times, that is a change in the model updates the view and a change in the view updates the model.
3. Testing : Testing is an area where Angular really shines. Angular is designed with testing in mind right from the start. Angular makes it very easy to test any of it's components through both unit testing and end to end testing. So there's really no excuse for not testing any of your angular application code.
4. Model View Controller : With angular it is very easy to develop applications in a clean MVC way. All you have to do is split your application code into MVC components. The rest, that is managing those components and connecting them together is done by angular.

To get started with angular

1. Add a reference to the angular script
2. Include ng-app attribute

What is ng-app

What is ng-app In angular, ng-app is called a directive. There are many directives in angular. You can find the complete list of directives on https://angularjs.org. The ng prefix in the directive stands for angular. The ng-app directive is a starting point of AngularJS Application. Angular framework will first check for ng-app directive in an HTML page after the entire page is loaded. If ng-app directive is found, angular bootstraps itself and starts to manage the section of the page that has the ng-app directive. So the obvious next question is, where to place the ng-app directive on the page It should be placed at the root of the HTML document, that is at the tag level or at the tag level, so that angular can control the entire page. However, there is nothing stopping you from placing it on any other HTML element with in the page. When you do this only that element and it's children are managed by angular. Double curly braces are called binding expressions in angular.

What is a module in AngularJS

A module is a container for different parts of your application i.e controllers, services, directives, filters, etc

Why is a module required

You can think of a module as a Main() method in other types of applications. For example, a Dot Net console application has a Main() method which is the entry point into the application and it wires together the different parts of the application. Modules are the angular application's equivalent of the Main() method. Modules declaratively specify how the angular application should be bootstrapped.

How to create a module

Creating a module in angular is staright forward. Use the angular object's module() method to create a module. The angular object is provided by angular script. The following example, creates a module.
var myApp = angular.module("myModule", [])
The first parameter specifies the name of the module. The second parameter specifies the dependencies for this module A module can depend on other modules. We will discuss an example of module dependencies in a later video. Right now, the module that we are creating is not dependent on any other external modules, so I am passing an empty array as the value for the second parameter.

What is a controller in angular

In angular a controller is a JavaScript function. The job of the controller is to build a model for the view to display. The model is the data. In a real world application, the controller may call into a service to retrieve data from the database.

How to create a controller in angular

Simple, create a JavaScript function and assign it to a variable
var myController = function ($scope) { $scope.message = "AngularJS Tutorial"; }

No comments:

Post a Comment