Angularjs tricky interview questions

1.What is AngularJS ?

AngularJS is a javascript open source framework used for making extensible web applications and dynamic web pages.It allows you to use HTML as your template language and runs on plain javascript and HTML.

Angularjs tricky interview questions


2.Define scope in AngularJS.

Scope is an object that refers to the application model. It acts as glue between controller and view. Scopes are hierarchical in nature and follow the DOM (Document Object Model) structure of your angular app.

AngularJS has two scope objects: $rootScope and $scope.

$scope
A $scope is a JavaScript object which is used for communication between controller and view. Basically, $scope binds a view (DOM element) to the view model and functions defined in a controller.

$rootScope
The $rootScope is the top-most scope. An app can have only one $rootScope which will be shared among all the components of an app. Hence it acts like a global variable. All other $scopes are children of the $rootScope.

3.Is AngularJS compatible with all browsers? 

Yes.

4.What are directives? 

Directive is used to provide extra functionality on the HTML element. For instance, the ng-click directive gives an element the ability to listen for the click event and run an Angular expression when it receives the event.Directives are what makes the Angular framework so powerful, and, as we’ve seen, we can also create them.
A directive is defined using the .directive() method, one of the many methods available on our applications Angular module.

5.What are the types of Directive?

Element directives
Attribute directives
CSS class directives
Comment directives

6.Explain what are the key features of AngularJS?

Key features of AngularJS are

Scope
Controller
View
Model
Services
Data Binding
Directives
Testable
Filters

7.What is services in AngularJS?

In angularjs service is the function which is used to handle the server communication over the browser with help of XMLHttpRequest object and $http.

8.What is the Template in AngularJS?

The template is the HTML portion of the angular app. It is exactly like a static HTML page, except that templates contain additional syntax which allows data to be injected in it in order to provide a customized user experience.

9.What are basic steps to set up an Angular app?

Create an angular.module
Assign a controller to the module
Link your module to HTML with ng-app
Link the controller to HTML with ng-controller directive.

10.Is AngularJS a library or framework?

AngularJS is not a library but open source client side MVC (Model View Controller) framework for creating dynamic web applications. It is lightweight and can use jQuery library if it's present in your application when the app 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.

11.What is Single Page Application (SPA)? 

SPA is the concept whereby pages are loaded from the server not by doing post backs, rather by creating a single shell page or master page and loading the web pages into the master page.

12.Who created Angular JS?

Angular JS was developed by Misko Hevery and Adam Abrons and later developed by Google.

13.what is the difference between AngularJS and backbone.js?

AngularJS combines the functionalities of most of the 3rd party libraries, it supports individual functionalities required to develop HTML5 Apps.  While Backbone.js do their jobs individually.

14.What is DI (Dependency Injection) and how an object or function can get a hold of its dependencies?

DI or Dependency Injection is a software design pattern that deals with how code gets hold of its dependencies. In order to retrieve elements of the application, the operation “config” uses dependency injection which is required to be configured when the module gets loaded.

The ways that object use to hold of its dependencies are:
Typically, dependency can be created using the new operator.
Dependency can be looked up, by referring to a global variable.
Dependency can be passed to where it is required.

15. What are the major browsers Supported by Angular js?

Here are some major browsers supported by Angular js like:

Mozilla Firefox
Google Chrome
Microsft Edge
IE 10,11
IE Mobile,
Safari, iOS
Android: Nougat (7.0) Marshmallow (6.0)


EmoticonEmoticon