AngularJS Interview Questions

13. Two similar “destroy” events are fired when a scope is terminated, So what are they used for?
1. An AngularJS event , “$destroy”
2. jqLite / jQuery event “$destroy”.

14. Whether AngularJS is extensible or not ?
Yes. In AngularJS we can create custom directive to extend AngularJS existing functionalities. Custom directives are used in AngularJS to extend the functionality of HTML. Custom directives are defined using “directive” function. A custom directive simply replaces the element for which it is activated.

15. How do you reset a “$timeout”?
var customTimeout = $timeout(function ()
{
// arbitrary code
}, 55);
$timeout.cancel(customTimeout);

16. Explain $scope in AngularJS?
$scope in AngularJS is an object which refers to an application model. It is an object that binds view (DOM element) with the controller. The $scope is a special JavaScript object. Both View and controller have access to the scope object. It can be used for communication between view and controller. Scope object contains both data and functions.

COPY CODE SNIPPET