Part 1: AngularJS Interview Questions And Answers

AngularJs is powerful framework for DOM manipulation. There are a lot of angular developer opportunities available in market, so you can learn and get opportunities with good benefit, here I am sharing you some angular interview questions which are interviewer asking in angular interview.Below angular questions are basic angular interview questions.

You can also check other tutorial of angular,

Angularjs Interview Questions :

1- What is AngularJS ?

AngularJS is a JavaScript framework which simplifies binding JavaScript objects with HTML UI elements. It helps to extend html element as well create your custom html element. AngularJS mainly used for create Single page application.

AngularJS is MVC?


How’s Angular Work?

First browser parses the HTML and creates a DOM (Document Object Model) object then Angular framework runs over this DOM looks at the Angular directives and manipulates the DOM accordingly and rendered as HTML in the browser.

What is Difference between “$rootScope” and “$scope”?

Both are used for define accessibly of variable, $rootscope used for define global variable whereas scope used for access variable only definer controller.

Do I need Jquery for Angular?

No, It has built in JQLite library, Which work as same like jQuery do.

How is the data binding in Angular ?

Its two way binding. So whenever you make changes in view entity the variable change and updated. The same process also vice versa.

What is services in Angular.js ?

The services are the singleton objects or functions that are used for perform specific tasks. Services contains business logic and can be used as controllers, directive, filters and so on.

Explain what are directives ?

A directive is JavaScript function that manipulate and add behaviors to HTML DOM elements. There are a lot of per-defined directive ng-model or ng-repeat etc. You can define your custom directive as well as per your requirement.
Different types of directives are :

  • Element directives
  • Attribute directives
  • CSS class directives
  • Comment directives

Explain what is injector?

Injector is very important feature of angular, Injector is a service locator, which is used to get object instance of provider and invoke method with help of object instance.

What are Difference between link and compile in angular.js?

Compile is used for template DOM Manipulation whereas Link is used for registering DOM listeners. Link is executed once after the template has been cloned.

What are difference between $watch(), $digest() and $apply()

$watch : This function is used for observe changes in the variable on the $scope object.
$digest() : This function used to update data binding, its iterates on all the watches in the $scope object and its child $scope objects.
$apply() : $apply() is used to execute some code and then angular internally called $scope.$digest() method to update data binding of $scope object. This function is useful when you need to execute some code outside of angular scope.

What are difference between emit and broadcast?

$broadcast : Used for dispatches the event downwards to all child scopes.
$emit : Used for dispatches the event upwards through the parent controller scope hierarchy