Thursday, 19 January 2017

ANGULARJS INTERVIEW QUESTIONS - Set 3


To Know more about the trending framework AngularJS, Visit AngularJS Training

21. Mention what are the characteristics of “Scope”?


To observer model mutations scopes provide APIs ($watch)
To propagate any model changes through the system into the view from outside of the Angular realm
A scope inherits properties from its parent scope, while providing access to shared model properties, scopes can be nested to isolate application components.
Scope provides context against which expressions are evaluated

22. Explain 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 which is required to be configured when module gets loaded , the operation “config” uses dependency injection.

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

23. Mention what are the advantages of using Angular.js framework?

 

Advantages of using Angular.js as framework are:
=>
Supports two way data-binding
=>Supports MVC pattern
=>Support static template and angular template
=>Can add custom directive
=>Supports REST full services
=>Supports form validations
=>Support both client and server communication
=>Support dependency injection
=>Applying Animations
=>Event Handlers

 

 

 24. Explain the concept of scope hierarchy? How many scope can an application have?

 

Each angular application consist of one root scope but may have several child scopes. As child controllers and some directives create new child scopes, application can have multiple scopes. When new scopes are formed or created they are added as a children of their parent scope. Similar to DOM, they also creates a hierarchical structure.

25. Explain what is the difference between angular.js and backbone.js?

 

Angular.js 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.

26. Who created Angular JS ?

 

Intially it was developed by Misko Hevery and Adam Abrons. Currently it is being developed by Google.

27. What is Angular.js?

 

AngularJS is open source client side MV* (Model – View – Whatever) framework for creating dynamic web applications. It gives life to your static HTML and makes it dynamic with its magic. It extends HTML using directives, expression and data binding techniques to define a powerful HTML template.

28. Is AngularJS a framework, library or a plugin?

 

The suitable answer is that its a framework. As its lightweight so people also get confused between library and framework.AngularJS is open source client side MVC framework for creating dynamic web applications.

29. Is it same as jQuery?


NO. 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.

30. How can we decrease digest cycle time ?


To decrease digest cycle time you need to decrease the number of watchers.

Below are some best practices you can follow to decrease number of watchers :-
=> Remove unnecessary watchers.
=> Use one time Angular binding. Especially if you see ng-repeat loop apply one time binding.
=> Work in batches.
=> Cache DOM
=> Use Web worker.
To Know more about the trending framework AngularJS, Visit AngularJS Training

No comments:

Post a Comment