Features of AngularJS

an2

Model:  It’s a simple JavaScript object which used to transfer the data between the controller and view. This means our data lives in a model

View: Our HTML lives as a tiny template to be rendered as a View, and we use a Controller to connect the two, driving Model and View value changes.

Controller:

Modules: Every application in Angular is created using modules. A module can have dependencies of other modules, or be a single module all by itself. These modules act as containers for different sections of an application, making code more reusable and testable. To create a module, we hit the global angular Object, the framework’s namespace, and use the module method.

  • Setters: means we are creating a new module, while creating it we can import the other modules as well. In the [] we have to add the other modules.

Angular.module(‘sampleApp’,[])

  • Getters: For creating the directives, controllers etc… We have to use the existing modules.

Angular.module(‘sampleApp’)

HTML Bootstrapping: To declare where our application sits in the DOM, typically the <html> element, we need to bind an ng-app attribute with the value of our module. This tells Angular where to bootstrap our application.

$Scope vs $rootScope: $scope is limited to that a particular controller, While rootscope will be accessed to its child and parent controllers. Parent $rootScope value will be updated with the child $rootScope value.

Controllers: An Angular Controller allows us to interact with a View and Model, it’s the place where presentational logic can take place to keep the UI bindings in sync with the Model. A Controller’s purpose is to drive Model and View changes, in Angular it’s a meeting place between our business logic and our presentational logic.

AngularJS Introduction

Angular is a client-side MVW JavaScript framework for writing compelling web applications. It’s built and maintained by Google and offers a futuristic spin on the web and its upcoming features and standards.

MVW stands for Model-View-Whatever, which gives us flexibility over design patterns when developing applications. We might choose an MVC (Model-View-Controller) or MVVM (Model-View-ViewModel) approach.

Advantages of AngularJS 

  1. It supports two way data binding. So the view and the model are in sync at all times.
  2. AngularJS is a powerful JavaScript based development framework to create RICH Internet Application (RIA).
  3. Application written in AngularJS is cross-browser compliant. AngularJS automatically handles JavaScript code suitable for each browser.
  4. It has its own templating feature.
  5. It provides a superior dependency injection mechanism through which core components such as values, constants, services etc. can be injected into each other as dependencies.
  6. It can control the behaviour of DOM elements using directives.
  7. It can provide flexibility through filters.
  8. AngularJS is designed to support both unit testing and end to end testing. Its built-in dependency injection mechanism allows component’s dependencies and stub to be passed or mocked. There are also tools like Karma, Jasmine, etc. which can be used to test Angular applications.
  9. It is easy to develop MVC applications using Angular, as it automatically controls and connects the MVC components