AngularJS Interview Questions and Answers PDF : Set 1

Here we come with AngularJS interview questions with answers, which is very impotent for any developer, which prepare for interview, because these days AngularJS become very famous in the market. So if you go for any interview, must go through following AngularJS interview questions. pdf is also available.

What is AngularJS?
Ans: AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page applications. Its goal is to augment browser-based applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.

What are Directives in AngularJS?
Ans: At a high level, directives are markers on a DOM element (such as an attribute, element name, comment or CSS class) that tell AngularJS's HTML compiler ($compile) to attach a specified behavior to that DOM element.
Angular comes with a set of these directives built-in, like ngBind, ngModel, and ngClass. Much like you create controllers and services, you can create your own directives for Angular to use. When Angular bootstraps your application, the HTML compiler traverses the DOM matching directives against the DOM elements.

What are the key features of AngularJS?
Ans: The key features of AngularJS are Modules, Directives, Templates, Scope, Expressions, DataBinding, MVC (Model, View & Controller), Validations, Filters, Services, Routing, Dependency Injection, Testing.

Who created AngularJS?
Ans: Intially it was developed by Misko Hevery and Adam Abrons. Currently it is being developed by Google.

Why Use AngularJS?

When to Use AngularJS?

Why is this project called "AngularJS"? Why is the namespace called "ng"?
Ans: Because HTML has Angular brackets and "ng" sounds like "Angular".

Is AngularJS a library, framework, plugin or a browser extension?
Ans: AngularJS fits the definition of a framework the best, even though it's much more lightweight than a typical framework and that's why many confuse it with a library.
AngularJS is 100% JavaScript, 100% client-side and compatible with both desktop and mobile browsers. So it's definitely not a plugin or some other native browser extension.

Is AngularJS a templating system?
Ans: At the highest level, Angular does look like just another templating system. But there is one important reason why the Angular templating system is different, that makes it very good fit for application development: bidirectional data binding. The template is compiled in the browser and the compilation step produces a live view. This means you, the developers, don't need to write code to constantly sync the view with the model and the model with the view as in other templating systems.

Do I need to worry about security holes in AngularJS?
Ans: Like any other technology, AngularJS is not impervious to attack. Angular does, however, provide built-in protection from basic security holes including cross-site scripting and HTML injection attacks. AngularJS does round-trip escaping on all strings for you and even offers XSRF protection for server-side communication.
AngularJS was designed to be compatible with other security measures like Content Security Policy (CSP), HTTPS (SSL/TLS) and server-side authentication and authorization that greatly reduce the possible attack vectors and we highly recommend their use.

Can I download the source, build, and host the AngularJS environment locally?
Ans: Yes. See instructions in Downloading.

What browsers does Angular work with?
Ans: We run our extensive test suite against the following browsers: Safari, Chrome, Firefox, Opera 15, IE9 and mobile browsers (Android, Chrome Mobile, iOS Safari). See Internet Explorer Compatibility for more details in supporting legacy IE browsers.

What's Angular's performance like?
Ans: The startup time heavily depends on your network connection, state of the cache, browser used and available hardware, but typically we measure bootstrap time in tens or hundreds of milliseconds.
The runtime performance will vary depending on the number and complexity of bindings on the page as well as the speed of your backend (for apps that fetch data from the backend). Just for an illustration we typically build snappy apps with hundreds or thousands of active bindings.

How big is the angular.js file that I need to include?
Ans: The size of the file is < 36KB compressed and minified.

Can I use the open-source Closure Library with Angular?
Ans: Yes, you can use widgets from the Closure Library in Angular.

Does Angular use the jQuery library?
Ans: 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.
Angular 1.3 only supports jQuery 2.1 or above. jQuery 1.7 and newer might work correctly with Angular but we don't guarantee that.

What is testability like in Angular?
Ans: Very testable and designed this way from ground up. It has an integrated dependency injection framework, provides mocks for many heavy dependencies (server-side communication). See ngMock for details.

How is Angular licensed?
Ans: The MIT License.

Can I download and use the Angular logo artwork?
Ans: Yes! You can find design files in our github repository, under "angular.js/images/logo" The logo design is licensed under a "Creative Commons Attribution-ShareAlike 3.0 Unported License". If you have some other use in mind, contact us.

How can I get some AngularJS schwag?
Ans: We often bring a few t-shirts and stickers to events where we're presenting. If you want to order your own, the folks who make our schwag will be happy to do a custom run for you, based on our existing template. By using the design they have on file, they'll waive the setup costs, and you can order any quantity you need.
Stickers For orders of 250 stickers or more within Canada or the United States, contact Tom Witting (or anyone in sales) via email at, and tell him you want to order some AngularJS stickers just like the ones in job #42711. You'll have to give them your own info for billing and shipping.
As long as the design stays exactly the same, StickerGiant will give you a reorder discount.
For a smaller order, or for other countries, we suggest downloading the logo artwork and making your own.

Name the angular module which is used to enable URL routing?
Ans: ng-route

Which module helps to write unite tests by providing mock modules etc?
Ans: ng-mock

Name some of the most commonly used angular directives, with description?
    Declares the root element of an AngularJS application, under which directives can be used to declare bindings and define behavior.
    Sets the text of a DOM element to the value of an expression. For example, <span ng-bind="name"></span> will display the value of ‘name’ inside the span element. Any changes to the variable ‘name’ in the application's scope are reflected instantly in the DOM.
    Similar to ng-bind, but establishes a two-way data binding between the view and the scope.
    Allows tuning how model updates are done.
    Allows class attributes to be dynamically loaded.
    Specifies a JavaScript controller class that evaluates HTML expressions.
    Instantiate an element once per item from a collection.
ng-show & ng-hide
    Conditionally show or hide an element, depending on the value of a boolean expression. Show and hide is achieved by setting the CSS display style.
    Conditionally instantiate one template from a set of choices, depending on the value of a selection expression.
    The base directive responsible for handling routes that resolve JSON before rendering templates driven by specified controllers.
    Basic if statement directive which allow to show the following element if the conditions are true. When the condition is false, the element is removed from the DOM. When true, a clone of the compiled element is re-inserted

Is Angular filters format data for display to the user?
Ans: yes

How you can make a field read only, which directive you can use for it?
Ans: ng-readonly

What angular function you can use to iterate through each item in a object?
Ans: angular.forEach()

Is Angularjs depends on Jquery?
Ans: No, but it does embed jqLite.

Which directive can you use to pervent the html template being briefly displayed by the browser in its raw form?
Ans: ng-cloak

If jQuery is not avaliable to angularJS, what library does it delegate limited jquery functions to?
Ans: jqlite

How you can invoke a directive from HTML, Write the sample code?
As a class: <span class="my-directive: expression;"></span>
As an attribute: <span my-directive></span>
As an element: <my-directive></my-directive>

What is the difference between ng-view and ng-show?
Ans: ng-view: ng-view renders the template inside the associated element, whereas ng-show shows or hide the associated HTML element based on whether the expression provided to ngShow attribute evaluates to true or false.

Think you want to make 3 ajax request and you need to maintain order, When request 1 is completed you have to make request 2, when request 2 is completed you have to make request 3. What angular feature would you have to use in this situation.
Ans: Promise chaining

Difference between AngularJS and KnockoutJS?

Difference between AngularJS and AJAX?

Name the angular function which used to determines if a reference is a number?
Ans: angular.isNumber()

Which object-reference can we inject in the config-function of a module, When we have a provider called "unicornLauncher"
Ans: unicornLauncherProvider

Can you write the sample code to configure a route in AngularJS
Ans: $routeProvider.when('/',{templateUrl: 'views/main.html',controller: 'MainCtrl'});

How do you make angularjs modules available to an application?
Ans: using angular.module()

Name the directive which is used to attach a controller to the DOM?
Ans: ng-controller

To get pdf with more Angular JS questions answers, leave your emailid as a comment.














Contact Form