Tuesday 3 January 2017

Interview Questions for recruiting experienced AngularJS Developers

List of AngularJS interview questions to help you prepare for your AngularJS technical interview, Read the most frequently asked 100 top AngularJS Interview Questions and Answers for freshers and experienced pdf

AngularJS Interview Questions and Answers List

41. What are different type or classification of directives?
 AngularJS directives can be classified in 4 different types .
Element directives
 <ng-directive></ng-directive>
Attribute directives
<span ng-directive></span>
CSS class directives
<span class="ng-directive: expression;"></span>
Comment directives
<!-- directive: ng-directive expression -->

42. What is the name of directive is used to bootstrap an angular app?
 ng-app directive is used to auto-bootstrap an AngularJS application. The ng-app directive defines the root element of the application and is typically present in the root element of the page - e.g. on the <body> or <html> tags.

43. Can AngularJS have multiple ng-app directives in a single page?
 The answer is NO. Only one AngularJS application can be auto-bootstrapped per HTML document. The first ngApp found in the document will be used to define the root element to auto-bootstrap as an application. If you have placed another ng-app directive then it will not be processed by AngularJS. You need to manually bootstrap the second app, instead of using second ng-app directive. Read

44. Can angular applications (ng-app) be nested within each other?
 NO. AngularJS applications cannot be nested within each other.

45. Can you bootstrap multiple angular applications on same element?
 NO. If you try to do that then it will show an error "App Already Bootstrapped with this Element". This usually happens when you accidentally use both ng-app and angular.bootstrap to bootstrap an application. You can also get this error if you accidentally load AngularJS itself more than once.

46. In how many different ways, you can define a directive and what is the best practice?
 Angular generally prefers camelCase for directives. But since HTML is not case-sensitive so it refers to directive in DOM in lower case form, delimited by dash (eg. ng-app). But when Angular complies then it normalize the directives.
Below are example of valid directive declaration.
    ng-model
    ngModel
    ng:model
    ng_model
    data-ng-model
    x-ng-model

The normalization process is as follows:
1. Strip x- and data- from the front of the element/attributes.
2. Convert the :, -, or _-delimited name to camelCase.
The best practice to use dash-delimited (ng-model) or directly camelCase form (ngModel). If you are using HTML validation tool, then it is advised to use data- prefixed version. And it also answers another question which is "Difference between ng-* and data-ng-*".

47. Mention some angularJS directives and their purpose?
 The beauty of AngularJS directives is that they are self explainatory. By just looking at directive name, you will get the idea about purpose and use of directive. Below are some mostly used
directives.
ng-app : Initializes application.
ng-model : Binds HTML controls to application data.
ng-Controller : Attaches a controller class to view.
ng-repeat : Bind repeated data HTML elements. Its like a for loop.
ng-if : Bind HTML elements with condition.
ng-show : Used to show the HTML elements.
ng-hide : Used to hide the HTML elements.
ng-class : Used to assign CSS class.
ng-src : Used to pass the URL image etc.

Event Listeners
ng-click : Click event to bind on HTML elements.
ng-dbl-click
Mouse event listeners
ng-mousedown
ng-mouseup
ng-mouseenter
ng-mouseleave
ng-mousemove
ng-mouseover
Keyboard event listeners
ng-keydown
ng-keyup
ng-keypress
ng-change

48. What is Angular Expression?
 Angular expressions are JavaScript-like code snippets that are usually placed in bindings such as {{ expression }}. For example, these are valid expressions in Angular:
    {{ 3+4 }}
    {{ a+b }}
    {{ user.name }}
    {{ items[index] }}

49. How Angular expressions are different from JavaScript expressions?
 Angular expressions are like JavaScript expressions but there are few differences.
 Context : In Angular, the expressions are evaluated against a scope object, while the JavaScript expressions are evaluated against the global window object.
 Forgiving: In Angular expression evaluation is forgiving to null and undefined, while in JavaScript undefined properties generates TypeError or ReferenceError.
 No Control Flow Statements: Loops, conditionals or exceptions cannot be used in an Angular expression.
 No Comma And Void Operators: You cannot use , (comma) or void in an Angular expression. And You cannot create regular expressions in an Angular expression.

50. What is compilation process in Angular?
 Once you have the markup, the AngularJS needs to attach the functionality. This process is called "compilation" in Angular. Compiling includes rendering of markup, replacing directives, attaching events to directives and creating a scope. The AngularJS has compiler service which traverses the DOM looking for attributes. The compilation process happens in two phases.
Compilation : traverse the DOM and collect all of the directives and creation of the linking function.
Linking: combine the directives with a scope and produce a live view. The linking function allows for the attaching of events and handling of scope. Any changes in the scope model are reflected in the view, and any user interactions with the view are reflected in the scope model.
When you create a new directive, you can write compile and/or linking functions for it to attach your custom behavior.
To understand the compilation process of Angular, must read "The nitty-gritty of compile and link functions inside AngularJS directives".
Read More Angular JS Interview Questions:-
AngularJs Interview Questions Part1
AngularJs Interview Questions Part2
AngularJs Interview Questions Part3
AngularJs Interview Questions Part4
AngularJs Interview Questions Part5
AngularJs Interview Questions Part6

5 comments:

  1. Thanks for sharing this AngularJS interview questions. It is really helpful to me and I have bookmarked this page for my future reference.
    Angularjs Training in Chennai | Angular 2 Training in Chennai

    ReplyDelete
  2. Hi There,


    Thank you! Thank you! Thank you! Your blog was a total game changer!
    I have biggest confusion to choose my career.any help me ..
    I'm a new to asp.net mvc development.
    I have some questions regarding that

    1.Use of Entity Framework.?
    2.Why do use jquery .?
    3.AngularJS Development.?
    Can anyone suggest a couple of example.?

    Very useful article, if I run into challenges along the way, I will share them here.


    Many Thanks,
    Charles

    ReplyDelete
  3. Thanks for information , This is very useful for me.
    Keep sharing Lean Six Sigma Green Belt Training Bangalore


    ReplyDelete