Sunday 26 February 2017

Interview Q & A : AngularJS

1. What is AngularJS?

Angular JS is a Javascript framework. Angular JS extends HTML with ng-directives.
The ng-app directive defines an AngularJS application.
The ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
The ng-bind directive binds application data to the HTML view.

2. Why to use AngularJS or what all are the advantages of angular JS?

Advantage of using AngularJS:
i)Supports MVC
ii)Uses the plain javascript objects
iii)A declarative user interface
iv)Filters filter the data before reaching view
v)Write less code

3. How AngularJS is different from other JavaScript Framework?

AngularJS is a framework. It has following features
  • Two way data binding
  • MVC framework
  • Template
  • Custom-directive (reusable components)
  • REST-friendly
  • set up a link for any dynamic page
  • Form Validation
  • Server Communication
  • Localization
  • Dependency injection
  • Full testing environment

4. What IDEs you can use for AngularJS development?

You can write angular JS in any IDE

5. Compare the features of AngularJS and jQuery?

JqueryAngular JS
Restful APInoyes
Integration test runnernoyes
MVC supportnoYes
templatenoyes
two way of bindingnoyes
dependency managementnoyes
AJAXyesyes
Unit test runneryesyes
cross module communicationyesyes
form validationnoyes
Localizationnoyes
file size32kb38kb

6. Is AngularJS a library, framework, plugin or a browser extension?

framework

7. What browsers AngularJS support?

Angular JS supports all major browsers, IE8 and above,safari,mozila,chrome etc

8. What is the size of angular.js file?

38kb

9. What are AngularJS features?

AngularJS is a framework. It has following features
1.Two way data binding
2.MVC framework
3.Template
4.Custom-directive (reusable components)
5.REST-friendly
6.set up a link for any dynamic page
7.Form Validation
8.Server Communication
9.Localization
10.Dependency injection
11.Full testing environment

10. How AngularJS handle the security?

i) Define global variables in app-module
ii)Define the service for Authorization
iii)use security in routing

11. What are Modules in AngularJS?

A module is a container for different parts of application

12. What components can be defined within AngularJS modules?

Application name and controller name can be defined in Module

13. What is core module in AngularJS?

To install angular-module-core, simply install it as a dependency in your Node.js project.

14. What is difference between config() and run() method in AngularJS?

The module can have both config and run functions.
The run()could be useful to perform any kind of initialization after the objects instances registered in the module have already been created.
The config() is useful to configure providers before they are actually created

15. What is Global API?

The global APIs are available when the angular.js library is loaded, and you can access them by using the angular object

16. What is Angular Prefixes $?

$ prefix is for angularJS predefined service only.

17. What are Filters in AngularJS?

Filters can be added to expressions and directives using a pipe character.
AngularJS filters can be used to transform data
currency – Format a number to a currency format.
filter – Select a subset of items from an array.
lowercase – Format a string to lower case.
orderBy – Orders an array by an expression.
uppercase – Format a string to upper case.

18. What are Expressions in AngularJS?

AngularJS expressions are written inside double braces: {{ expression }}.Binds data to HTML the same way as the ng-bind directive.it would “output” data exactly where the expression is written.
These are like JavaScript expressions: They can contain literals, operators, and variables.

19. What are Directives in AngularJS?

Angular JS extends attributes called directives
ng-app directive initializes an AngularJS application.
ng-init directive initializes application data.
ng-model directive binds the value of HTML controls (input, select, textarea) to application data.
20. What is the role of ng-app, ng-init and ng-model directives?
ng-app directive initializes an AngularJS application.
ng-init directive initializes application data.
ng-model directive binds the value of HTML controls (input, select, textarea) to application data.

21. What is restrict option in directive?

With the restrict property of a directive’s definition object we can decide where our directive can appear in the DOM. We have four options:
restrict: ‘E’ : The directive can appear only as HTML element
restrict: ‘A’ : The directive can appear only as HTML attribute in an element. This is the default value if restrict is not specified
restrict: ‘C’ : The directive can appear only inside a class attribute of a HTML element
restrict: ‘M’ : The directive can appear only inside a HTML comment.

22. What is bootstrap? Difference between auto bootstrap process and Manual bootstrap in AngularJS?

Bootstrap is a stylesheet.To include Bootstrap in your AngularJS application, add the following line to the head of your document:
<link rel=”stylesheet” href=”http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css“>

23. What is scope in AngularJS?

A $scope is an object that ties a view (a DOM element) to the controller. In the Model-View-Controller structure, this $scope object becomes the model

24. What is $scope and $rootScope?

The $rootScope is the top-most scope that is created on the DOM element that contains the ng-app directive
A $scope is an object that ties a view (a DOM element) to the controller. In the Model-View-Controller structure, this $scope object becomes the model

25. Explain directives ng-if, ng-switch and ng-repeat?

ng-if:
This directive can add / remove HTML elements from the DOM based on an expression. If the expression is true, it add HTML elements to DOM, otherwise HTML elements are removed from the DOM
ng-switch:
This directive can add / remove HTML elements from the DOM conditionally based on scope expression.
ng-repeat:
This directive is used to iterate over a collection of items and generate HTML from it.
Questions & Answer Courtesy by CsharpStar

No comments:

Post a Comment