AngularJS Interview Questions and Answers Set 2

11. Is it same as jQuery?

jQuery is great library for manipulating the DOM, providing better user experience with animations and effects. You can create website using jQuery but not a web application. jQuery is just a library to play around with HTML, where as AngularJS is a framework to build a dynamic web app as it supports two data binding, MVC, allow testability, templates and many more. Its like AngularJS like a toolbox and jQuery is just a tool. You can read more here.

12. Does Angular use the jQuery library?

YES, Angular can use jQuery if it’s present in your app when the application is being bootstrapped. If jQuery is not present in your script path, Angular falls back to its own implementation of the subset of jQuery that we call jQLite.

13. Why AngularJS?

AngularJS lets you extend HTML vocabulary for your application. The resulting environment is extraordinarily expressive, readable, and quick to develop.
MVC implementation is done right.
It extends HTML using directives, expression and data binding techniques to define a powerful HTML template.
Two way data-binding, form validations, routing supports, inbuilt services.
REST friendly.
Dependency injection support.
It helps you to structure and test your JavaScript code.

14. What are the key features/concepts of Angular.js?

When you start learning AngularJS, you will come across following terms and these are the features/concept of AngularJS.

Data Bindings
Dependency Injection

15. List out the components which can be used in AngularJS modules?

Below are the list of components –


Weekend / Weekday Batch


16. Is AngularJS is compatible with all modern browsers?

YES. AngularJS team run extensive test suite against the following browsers: Safari, Chrome, Firefox, Opera 15, IE9 and mobile browsers (Android, Chrome Mobile, iOS Safari).

17. What Are The Security Features Provided By AngularJS?

AngularJS provides built-in protection from the following security flaws.

It prevents cross-side scripting attacks: Cross-site scripting is a technique where anyone can send a request from client side and can get the confidential information easily.

It prevents HTML injection attacks.

It prevents XSRF protection for server side communication: It can be handled by “Auth token” mechanism. When the user logins for the first time a user id and password is sent to the server and it will, in turn, return an auth token. Now, this token does the authentication in the future transactions.

18. What is MVC Architecture in AngularJS?

In AngularJS, scope objects are treated as Model. The View is display of model that is your data. And the model gets initialized within a JavaScript constructor function, called Controller in AngularJS. Let take a look at below code to understand it better.

19. What Is SPA (Single Page Application) In AngularJS?

Single-Page Applications (SPAs) are web applications that fit on a single HTML page. It dynamically updates the web page as the user performs actions on the app.

SPAs use AJAX and HTML to create quick and responsive web apps. A single page load extracts all the web app code (JS, HTML, CSS).

Thus the user navigates to different parts of the application quickly as it happens without refreshing the whole page.

Key Characteristics of Single-Page Applications are as follows.

Its UI is fast and responsive. Also, the Back/Forward buttons present in the UI work properly.

IT contains more JavaScript code than actual HTML as compared to other applications.

Dynamic data loading occurs from the server-side. The API uses restful web service with JSON format.

It allows to pre-load and cache all the app pages. Thus fewer data download requests are made towards the server.

Applications written in AngularJS are cross-browser compliant. It automatically handles the JavaScript code suitable for each browser.

Even if the user has lost the internet connection, then also the SPA can work. As all the pages load in the starting itself.

20. How Is AngularJS Compilation Different From Other JavaScript Frameworks?

Javascript frameworks like backbone and jQuery process the template as a string and returns the result as a string. You have to dump this resulting string into the DOM where you wanted it with innerHTML().

AngularJS process the template in another way. It directly works on HTML DOM rather than strings and manipulates it as required. It uses two-way data binding between model and view to sync the data.