AngularJS Developer

  Home  Client Side Scripting  AngularJS Developer


“AngularJS Developer related Frequently Asked Questions by expert members with job experience as AngularJS Developer. These questions and answers will help you strengthen your technical skills, prepare for the new job interview and quickly revise your concepts”



125 AngularJS Developer Questions And Answers

41⟩ Tell me what is factory method in AngularJS?

For creating the directive, factory method is used. It is invoked only once, when compiler matches the directive for the first time. By using $injector.invoke the factory method is invoked.

 185 views

45⟩ Tell me what is constant?

constants are used to pass values at config phase considering the fact that value cannot be used to be passed during config phase.

mainApp.constant("configParam", "constant value");

 189 views

46⟩ Tell me what are the disadvantages of AngularJS?

Following are the disadvantages of AngularJS.

☛ Not Secure − Being JavaScript only framework, application written in AngularJS are not safe. Server side authentication and authorization is must to keep an application secure.

☛ Not degradable − If your application user disables JavaScript then user will just see the basic page and nothing more.

 189 views

47⟩ What is currency filter?

Currency filter formats text in a currency format.

In below example, we've added currency filter to an expression returning number using pipe character. Here we've added currency filter to print fees using currency format.

Enter fees: <input type = "text" ng-model = "student.fees">

fees: {{student.fees | currency}}

 177 views

48⟩ Do you know what is MVC?

Model View Controller or MVC as it is popularly called, is a software design pattern for developing web applications. A Model View Controller pattern is made up of the following three parts:

☛ Model − It is the lowest level of the pattern responsible for maintaining data.

☛ View − It is responsible for displaying all or a portion of the data to the user.

☛ Controller − It is a software Code that controls the interactions between the Model and View.

 185 views

50⟩ What is ng-hide directive?

ng-hide directive hides a given control.

In below example, we've added ng-hide attribute to a HTML button and pass it a model. Then we've attached the model to a checkbox and can see the variation.

<input type = "checkbox" ng-model = "showHide2">Hide Button

<button ng-hide = "showHide2">Click Me!</button>

 197 views

51⟩ Tell me how do you share data between controllers?

Create an AngularJS service that will hold the data and inject it inside of the controllers.

Using a service is the cleanest, fastest and easiest way to test.

However, there are couple of other ways to implement data sharing between controllers, like:

☛ Using events

☛ Using $parent, nextSibling, controllerAs, etc. to directly access the controllers

☛ Using the $rootScope to add the data on (not a good practice)

☛ The methods above are all correct, but are not the most efficient and easy to test.

 217 views

52⟩ Tell me what is services in AngularJS?

In AngularJS services are the singleton objects or functions that are used for carrying out specific tasks. It holds some business logic and these function can be called as controllers, directive, filters and so on.

 181 views

54⟩ Explain me what Are The Key Features Of AngularJS?

Here is the list of AngularJS features that makes it the hottest tech for web dev.

☛ Data-binding – Handles synchronization of data across model, controllers, and view.

☛ Scope – Object representing the model, acts as a glue layer between controller and view.

☛ Controllers – JS functions bound to the scope object.

☛ Services – Substitutable objects that are wired together using dependency injection. e.g. $location service.

☛ Filters – Formats the value of an expression for displaying to the user. e.g. uppercase, lowercase.

☛ Directives – These are extended HTML attributes start with the “ng-” prefix. e.g. ng-app directive used to initialize the angular app.

☛ Templates – HTML code including AngularJS specific elements and attributes.

☛ Routing – It’s an approach to switch views.

☛ MVC pattern – A design pattern made up of three parts.

☛ Model – Represents data, could be static data from a JSON file or dynamic data from a database.

☛ View – Renders data for the user.

☛ Controller – Gives control over the model and view for collating information to the user.

☛ Deep linking – Enables the encoding of the application state in the URL and vice versa.

☛ Dependency injection – A design pattern to let the components injected into each other as dependencies.

 189 views

55⟩ Explain me what makes AngularJS better?

☛ Registering Callbacks: There is no need to register callbacks . This makes your code simple and easy to debug.

☛ Control HTML DOM programmatically: All the application that are created using Angular never have to manipulate the DOM although it can be done if it is required

☛ Transfer data to and from the UI: AngularJS helps to eliminate almost all of the boiler plate like validating the form, displaying validation errors, returning to an internal model and so on which occurs due to flow of marshalling data

☛ No initilization code: With AngularJS you can bootstrap your app easily using services, which auto-injected into your application in Guice like dependency injection style

 188 views

56⟩ What is the Model View Controller (MVC)?

MVC is a common design pattern used in developing software that consists of three parts: the model, view, and controller. The model is the lowest level of the pattern and is responsible for maintaining data. The view is the part of the application that is presented to the user. The controller is the code that governs all interactions between the model and the view.

 184 views

57⟩ What is injector in AngularJS?

An injector is a service locator, used to retrieve object instance as defined by provider, instantiate types, invoke methods, and load modules.

 203 views

58⟩ What is ng-include directive?

Using AngularJS, we can embed HTML pages within a HTML page using ng-include directive.

<div ng-app = "" ng-controller = "studentController">

<div ng-include = "'main.htm'"></div>

<div ng-include = "'subjects.htm'"></div>

</div>

 204 views

59⟩ Explain me what is dependency injection and how does it work?

AngularJS was designed to highlight the power of dependency injection, a software design pattern that places an emphasis on giving components their dependencies instead of hard coding them within the component. For example, if you had a controller that needed to access a list of customers, you would store the actual list of customers in a service that can be injected into the controller instead of hardcoding the list of customers into the code of the controller itself. In AngularJS you can inject values, factories, services, providers, and constants.

 220 views

60⟩ Tell me what are the controllers in AngularJS?

Controllers are JavaScript functions that are bound to a particular scope. They are the prime actors in AngularJS framework and carry functions to operate on data and decide which view is to be updated to show the updated model based data.

 202 views