Angular JS Top 10 Interview Questions
Tags: angular, education, software
Published: 2020-07-21 05:38:00

1. What are expressions in Angular?
AngularJs Expressions are used to bind application data to html. Expressions are written inside double braces like . Expressions behave in the same way as ng-bind directives. AngularJS application expressions are pure javascript expressions and output the data where they are used.

2. Do I need Jquery for Angular?
No, you do not need Jquery for Angular. It’s independent of Jquery.

3. What are advantages of MVVM over MVC?
Below are few advantages of MVVM over MVC:-
1.Increases the “Blendability” of your views (ability to use Expression Blend to design views)
2.“Lookless” view logic

No duplicated code to update views
Testability
Designer-Developer Workflow
4. Explain how $scope.$apply() works
$scope.$apply re-evaluates all the declared ng-models and applies the change to any that have been altered (i.e. assigned to a new value)
Explanation: $scope.$apply() is one of the core angular functions that should never be used explicitly, it forces the angular engine to run on all the watched variables and all external variables and apply the changes on their values

5. What is an interceptor? What are common uses of it?
An interceptor is a middleware code where all the $http requests go through.

The interceptor is a factory that are registered in $httpProvider. You have 2 types of requests that go through the interceptor, request and response (with requestError and responseErrorrespectively). This piece of code is very useful for error handling, authentication or middleware in all the requests/responses.

6. Mention what are the advantages of using AngularJS?
There are several advantages of AngularJS, we have listed some below:

AngularJS supports MVC pattern
Can do two ways data binding using AngularJS
It has pre-defined form validations
It supports both client-server communication
It supports animations
7. What is data binding? Explain two-way data binding in AngularJs?
Data binding means automatic synchronous of data between model and view components.

AngularJS supports two-way data binding, it treats the model as a single source of truth and view is a projection of model. It means when we change model view gets reflect and vice-versa.

In traditional concept, HTML pages are decided by interacting with server-side program and as we using single page application, pages are decided without any server-side interaction. So required part of the page will be updated.

8. Distinguish between AngularJS expression & JavaScript expression?
AngularJS expression:

Expressions are evaluated against $scope.

Expression evaluation is forgiving to null and undefined.

In AngularJS, loops, conditions and exceptions are not required to write.

AngularJS supports filters to format data before displaying.

JavaScript Expression:

Expressions are evaluated against Window object.

Undefined properties generates Type Error or Reference Error

In AngularJS, loops, conditions and exceptions are required to write.

No such a feature.

9. What is a model in AngularJs?
Model is JavaScript object and it binds view data into the model through the directives such as text field, text area and selects etc.

It provides validation behaviors by required, number, URL, email, min and max length etc.

10. Distinguish between factory, service & provider?
Factory:

When you’re using a Factory you create an object, add properties to it, then return that same object. When you pass this service into your controller, those properties on the object will now be available in that controller through your factory.

Service:

When you’re using Service, it’s instantiated with the ‘new’ keyword. Because of that, you’ll add properties to ‘this’ and the service will return ‘this’. When you pass the service into your controller, those properties on ‘this’ will now be available on that controller through your service.

Providers:

Providers are the only service you can pass into your .config() function. Use a provider when you want to provide module-wide configuration for your service object before making it available.

Meet The Experts : https://nareshit.com/angularjs-online-training/