AngularJS Interview Questions and Answers

What is the use of filter in AngularJS?

A filter is used to format the value of expression to display the formatted output. AngularJS enables us to write our own filter.
It can be used in an expression with pipe character.
Examples
Name in lower Case: {{student.fullName() | lowercase}}

Post comment
Cancel
Thanks for your comment.!
Write a comment(Click here) ...

What is AngularJS?

AngularJS is open source, JavaScript based framework which simplify the creation of single page web application.
Initially AngularJS was developed by MiskoHevery and Adam Abrons, and now it is built and maintained by Google. 
 

Why to use AngularJS?

1.    Easy to maintain , open source and cross browser compatible 
2.    Based on MVC (Model View Control) pattern
3.    Supports REST full services
4.    Supports two way data binding
5.    Supports form validations
6.    supports animation and Event Handling
7.    Extensible and testable
8.    Support dependency injection

Do I need jQuery for Angular?

No, Angular has its own subset of jQuery calledjQLite.
If jQuery present in the application then Angular use it. If jQuery is not located in the application script path, Angular usedjQLite.

Explain major components of AngularJS?

There are following major components of AngularJS
Module: It work as containers for components. Whereas an AngularJS application can have multiple modules.

Config: The config block represent module wise configuration settings for AngularJS application, whichapplied before application runs. 

Routes: Routes define a way between view loading and controller whereas multiple view can available on single page AngularJS application.

Views: The view is UI DOM on user browserafter rendering ofAngularJS Htmlpage.

Scope: It works between the view and controller within an AngularJS application and synchronize them.

Controller: The controller is acts as bridge between services and views, and responsible for defining methods and properties that the view can bind toand interact. 

Directive: directive extend behaviour of Html elementand allow to create custom,reusable elements that encapsulate behaviour. 

Service: Services provide functionality to an AngularJS application and extend controllers and make them more globally accessible.
 

What are Modules in AngularJS?

AngularJS modules work ascontainers. They logically divide an angular app into small, reusable and functional components. Each module is identified by a unique name and can be dependent on other modules. 
In AngularJS, ng is the core module and loaded by default when an angular app is started.

What are directives in AngularJS?

Directives are the AngularJS elements in Html tag that extend behaviour of Html element. All AngularJS directives start with the word "ng".
There are many built-in directives in AngularJS such as "ng-app", "ng-model", "ng-controller", "ng-repeat" etc.

What are the different types of directive in AngularJS?

In Angular, types of directives depending on their implementation on HTML tag.
So there are four types of directives-
Element directives
Attribute directives
CSS class directives
Comment directives

What is controller in AngularJS?

Controller is acting between the view and the services, whereas it is responsible for consuming data from services, processing data for display in the view, and transmitting data back to services for logic processing.
It should be lightweight and isolated from views.

What is data binding in AngularJS?

Data binding is the finest feature of theAngularJS, It is the automatic synchronization of the data between the model and view components. Whereas the view is a projection of the modelthat change withmodel changes, and vice versa.
There are two ways of data binding:
One way data binding (used in classical template)
Two way data binding (used in AngularJS template)

What are services in AngularJS?

AngularJS Services are the singleton functions or objects and used forprovide some functionality to the application. Services are prefixed with $ symbol and available globally to the entire application.

Ex.$http service is used forserver-side communication, $resource serviceused for support RESTful web services

What is scope in AngularJS?

Scope is a JavaScript object which synchronize controller with the views.
An AngularJS application has single $rootscope.The root scope has one or more child$scope objects associated with it whereas child scope inherits properties from its parent scope.

What is templateand view in AngularJS?

HTML element that contains Angular-specific attributes and directives called template in AngularJS.Whereas a view is the HTML after template has been through the AngularJS compilation process

Explain what are AngularJS routes does?

AngularJS routes enable you to create different URLs for different content in your application page without reloading the entire application. Different URLs for different content enables user to bookmark URLs to specific content. In AngularJS each such bookmarkable URL is called a route.

What are expressions in AngularJS?

Expressions are the code snippets that resolves to a value and used tobind application data to html. AngularJS expressions are placed inside {{expression}}.

What is the difference between AngularJS expressions and JavaScript expressions?

The main difference between the JavaScript expressions and Angular expressions are: 

•    TheJavaScript expressions are evaluated against the global window object, whereas in Angular the expressions are evaluatedagainst a scope object.

•    In JavaScript, undefined properties produces ReferenceError or TypeError, while In Angular expression evaluation is forgiving to undefined and null.

•    AngularJS expression doesn’t support loop, condition and exception, while java script do.

•    In AngularJS, filters can be used with expression to format data before displaying it but in JavaScript we can’t.

How to validate form data in AngularJS?

AngularJS has enriches client-side form filling validation. It support HTML 5 validations and also allow to creationof custom validation to validate data.
For example following can be used to track error: 
•    $dirty - states that value has been changed.
•    $invalid- states that value entered is invalid.
•    $touched-states that value has been touched.

Latest Updates

Indian Geography

What is the approximate distance between earth and the moon?

Indian History

In which year was the battle of ‘Koregaon Bhima’ fought?

The approach that is very useful in organizing the content in history is.

General Knowledge of India

NITI Aayog stands for _____.

General Knowledge of MP

India’s first Ramayan art museum was established at?

Errors Identification

Read the sentence carefully and choose the option that has an error in it:
The management’s trusted employee was suspected of stealing large sum of money.

Read the sentence carefully and choose the option that has an error in it:
The teacher asked the child to repeat again because he spoke feebly.

Fill in the blank

Fill in the blank with the most appropriate preposition in the given sentence.
Let’s sit _________ the shade of this beautiful tree.

Choose the most appropriate determiner for the given sentence.
________of what he said was very sensible.

Substitution

Choose the option that substitutes the given phrase appropriately.
A work of art made by carving

Correct sentence

Choose the option that best transforms the sentence into its Indirect form:
‘What country do you come from?’ said the police officer.

Alternative Phrase

Choose the option that best explains the highlighted expression:
All human beings have feet of clay.

Fill in the blank

Choose an appropriate modal for the given sentence:
My doctor said that I_____ stop smoking as one of my lungs got infected.

Choose the appropriate prepositions for the given sentence:
My parents have been married ________ forty-nine years, but you can still see the love ________ their eyes.

Choose the appropriate conjunction for the given sentence:
______ it rains, the college will declare the holiday.

Antonyms

Choose the appropriate antonym for the highlighted word in the given sentence.
The family protracted their visit by several days.

Tenses

Choose the appropriate tenses to fill in the blanks in the given sentence:
Please _________ a noise. Ritu __________ to sleep.

Synonyms

Choose the appropriate synonym for the highlighted word in the given sentence.
Does he really expect us to believe such a flimsy excuse?