Monday 30 November 2015

AngularJS Interview Questions and Answers for Experienced

AngularJS Interview Questions and Answers for Experienced



Question: What is AngularJS?
It is javasScript framework which is written in javascript. It is Best for Single Page Applications. It extend the html with new attributes which makes it more useful for UI Developer.


Question: In which language, AngularJS is written?
javaScript


Question: When First AngularJS was released?
2009

Question: When latest AngularJS was released?
November 24, 2017


Question: What is latest version of AngularJS?
1.6.7


Question: Who created AngularJS?
Misko Hevery started to work on AngularJS in 2009. He was employee of Google.
Question: Is it opensource?
Yes, It is free to use.



Question: Explain what are the key features of Angular.js?
  1. Scope
  2. Controller
  3. Model
  4. View
  5. Services
  6. Data Binding
  7. Directives
  8. Filters
  9. Testable



Question: From where we can download the AngularJS File?
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script>



Question: What is controller in AngularJS?
Controller is constructor function in Angular Controller.
When a Controller is attached to the DOM with use the ng-controller, Angular will instantiate a new Controller object using constructor function.



Question: Explain what are directives?
Directives are used to add new attributes of HTML.



Question: What are the different types of Directive?
Different types of directives are
  1. Element directives
  2. Attribute directives
  3. CSS class directives
  4. Comment directives



Question: Explain what is injector?
An injector is a service locator, used to retrieve object instances.



Question: Explain what are factory method in angularJs?
Factory method are used to create the directive. It is invoked only once, when compiler matches the directive for the first time.



Question: Does Angular use the jQuery library?
Ans. Yes, Angular can use jQuery if you have included the jQuery library.
IF Not, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.



Question: What is ng-app, ng-init and ng-model?
ng-app - To initialize the Angular Application.
ng-init - To initialize the Angular Application data.
ng-model - To bind the html tags (input, select, textarea) to Angular Application Data.



Question: What is Data Binding in Angular JS?
It is synchronization of data between the model(Angular Application variable) and view components (display with {{}}).



Question: Give an Example of Data-Binding in AngularJS?
<div ng-app="" ng-init="quantity=10;cost=5">
<b>Total Cost: {{ quantity * cost }}</b>
</div>


Question: What is Looping in AngularJs and Give an Example?
It is used to display the data in loop same as foreach in PHP
Example:
<div data-ng-app="" data-ng-init="names=['Web','Technology','Experts','Notes']">
<b>Loop Example:</b>
  <br />
<ul>
<li data-ng-repeat="x in names">
      {{ x }}
    </li>
</ul>
</div>

Question: How to Write Expression in AngularJS?
<div ng-app="">
<b>Expression: {{ 15 + 55 }}</b>
</div>



Question: How to initiate variable in AngularJS?
<div ng-app="" ng-init="quantity=10;cost=5">
<b>Total Cost: {{ quantity * cost }}</b>
</div>


OR

<div ng-app="" ng-init="quantity=1;cost=5">
<b>Total Cost: <span ng-bind="quantity * cost"></span></b>
</div>



Question: Example of AngularJS Strings?
<div ng-app="" ng-init="Str1='Web';Str2='Technology'">
Full String is : <b>{{ Str1 + " " + Str2 }}</b>
</div>




Question: Example of AngularJS Object?
<div ng-app="" ng-init="myobj={Str1:'Web',Str2:'Technology'}">
String Display: <b>{{ myobj.Str2 }}</b></div>



Question: What is Angular Controllers & give an Example?
Controller is constructor function in Angular Controller.
When a Controller is attached to the DOM with use the ng-controller, Angular will instantiate a new Controller object using constructor function.
Example:
<div ng-app="" ng-controller="StrControllerExample">
String 1: <input ng-model="str1" type="text" /><br />
String 2: <input ng-model="str2" type="text" /><br />
Full String <b> {{fullString()}}</b>
</div>
<script>
function StrControllerExample($scope) {
    $scope.str1 = "Web",
    $scope.str2 = "Technology",
    $scope.fullString = function() {
        return $scope.str1+ " " + $scope.str2;
    }
}
</script>




Question: What is Dependency Injection?
Dependency Injection (DI) is a software design pattern that deals with how components get deal of their dependencies.