AngularJS Interview Questions and Answers

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.

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}}

Latest Updates

Percentage

20% of a quantity is Rs 400, the quantity equals?

Time and Work

A certain piece of work can be completed by 12 men in 9 days. After they have worked for six days, six more men joined them. How many days will it take to complete the remaining work?

Ratio and Proportion

A certain sum was divided among A, B and C in the ratio 5 : 7 : 6. If B received Rs 4500 more than C, find C's share?

Problems on Ages

A is two years older than B who is twice as old as C. If the total of the ages of A, B and C be 27, the how old is A?

Time and Work

A and B can together finish a work in 30 days. They worked at it for 20 days and then B left. The remaining work was done by A alone in 20 more days. B alone can do the entire work in?

Discount

A retailer buys a washing machine marked at Rs 4800 and gets two successive discounts of 15% and 5%. If he spends Rs 124 on transportation and sells the washing machine at a gain of 13%, then find the selling price of the machine.

Boats and Streams

Speed of a boat in still water is 10 kmph, and speed of the stream is 5 Kmph. In how many minutes would the boat cover a distance of 5 km downstream?

Problems on Ages

The age of two persons differ by 2 years. If the sum of their ages is equal to the square root of 144 then find the age of the elder among the two person?

The age of A is six times the age of his son. A's father is 40 years older than him. Together, they are 118 years old. What is the age of A?

Average

The average mark of 50 students is 75. If the marks obtained by one of the student had been written as 36 instead of 86, then the corrected average of marks is:

Unix/Linux

What is inode?

Problems on Ages

A group of 15 people has average age of 45 years. Two persons are excluded and the average of the remaining is increased by 5 years. What is the average age of the two persons who have been excluded?

Average

In the world cup, Yuvraj has a batting average of 65 in 7 matches till semi-final. How much should Yuvraj score in the 8th match ie the final match to get a batting average of 85?

Problems on Trains

A train takes 8 sec to cross a 75 metre long platform at a speed of 90 km/h. What is the length of the train?

Alligation or Mixture

In what ratio must Rs 50 per kg salt be mixed with Rs 80 per kg salt to obtain a mixture worth of Rs 60 per kg?

Numbers

Find the sum of the given series: 3 + 9 + 27 + 81 + 243 + 729 + 2187 + 6561

Average

Find the average. 62, 54, 44, 36, 28 & 22

Percentage

In an examination, 36% of the students failed in English and 40% failed in Hindi. If 20% of the students failed in both subjects, then the pass percentage is?

Latest Job Notifications

Jobs in Madhya Pradesh

राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 5215 पद - 22/06/2021 अंतिम तिथि

Jobs in Punjab

पंजाब स्टेट पावर कॉर्पोरेशन लिमिटेड Punjab State Power Corporation Limited (PSPCL) - 2632 पद - 20/06/2021 अंतिम तिथि

Jobs in Chhattisgarh

स्वास्थ्य सेवा निदेशालय, छत्तीसगढ़ Department of Health & Family Welfare, Chhattisgarh - 267 पद - 26/06/2021 अंतिम तिथि

Government Jobs

दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 5807 पद - 03/07/2021 अंतिम तिथि

Jobs in Madhya Pradesh

राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 2850 पद - 31/05/2021 अंतिम तिथि

Government Jobs

इंडियन पोस्ट सर्विस Indian Post Service - 4368 पद - 29/05/2021 अंतिम तिथि

दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 7236 पद - 24/06/2021 अंतिम तिथि

Banking Jobs

Reserve Bank of India (RBI) - 841 Posts - 15/03/2021 Last date

Institute of Banking Personnel Selection (IBPS) - CRP SPL-IX - 1163 Posts - 26/11/2019 Last date

Government Jobs

Reserve Bank of India (RBI) - 199 Posts - 11/10/2019 Last date