AngularJS Interview Questions

AngularJS Interview Questions Download AngularJS Interview Questions PDF

AngularJS Interview Questions

AngularJS is a framework with key features like models, two-way binding, directives, routing, dependency injections, unit tests etc., whereas the Jquery is a library used for DOM manipulation with no two-way binding features.

The provider in AngularJS is used to internally create a factory, services etc., during the phase of configuration. The provider is the special factory method which is used to return the service/value/factory.

In order to disable the right click event in AngularJS, you need to add the disable-right-click as the element’s attribute. Simply use preventDefault(), this cancels the event and stops further propagation of the event.

$evalAsync executes the expression on the current scope at a later time and makes no guarantees as to when the expression will be executed.

$timeout also executes the expression on the current scope on later time but also runs after the DOM has been manipulated by the Angular and after the browser renders that cause flicker in some cases.

It is a scope that exists separately with no prototypal inheritance. It makes the components reusable and permits to control the binding either one-way or two-way.

Scopeless controllers have no $scope injected and the functions and properties are binded directly onto the controller. Scopeless controllers are used in the situation where the controller becomes complex by using the $scope to provide data.

The AngularJS provides a date filter through which you can format the date into the required form.

Syntax

{{ today | date:'MM/dd/yyyy'}}

To animate the application, you need to include the AngularJS Animate Library and then refer to the ngAnimate module into the application or add ngAnimate as a dependency in your application module.

It is used to prevent the Angular HTML template from getting displayed briefly by the browser in its uncompiled form while the application is still loading. It is used to avoid the undesirable flicker effect caused by HTML template display.

$Location is used when you don't want the full page to reload when the URL is changed and the window.location is used when you want to change the URL, reload the page or navigate to a different page.

The $scope is an object with the available methods and properties. It is used to get all controls on the controller.JS files. It is available for both the controller and the view. "This" is the controller used when the controller’s constructor function is called.

The $http.post method is used to send an http post request in AngularJS. The method has three parameters namely URL, data, config.

Define a directive, use that directive on the element we are targeting and have it $watch a trigger/property to know when to focus the element.

There are two ways to use a Multiple ng-app within a single page in AngularJS. One is the bootstrap method and the other is ngModules directive.

It is used to allocating the value of an object into another object however the object value must not be altered.

If you are adding any new property or altering any value of the property then the object noting to the same object will update by applying angular. Copy() method.