Thursday, January 29, 2015

AngularJS Interview Questions

Write a directive

If you have a million records, how do you display on a web page



Q: What is a scope in angularJS?

$scope is the application object (the owner of application variables and functions).
The concept of a scope in Angular is crucial. A scope can be seen as the glue which allows the template, model and controller to work together. Angular uses scopes, along with the information contained in the template, data model, and controller, to keep models and views separate, but in sync. Any changes made to the model are reflected in the view; any changes that occur in the view are reflected in the model.

Q: What is the difference between a service and a factory?

When used within a module, a service function call will return a new value each time it is calls. While a factory function call will return a consistent value each time it is called.


Q: What is bootstrapping?

This code downloads the angular.js script and registers a callback that will be executed by the browser when the containing HTML page is fully downloaded. When the callback is executed, Angular looks for the ngApp directive. If Angular finds the directive, it will bootstrap the application with the root of the application DOM being the element on which the ngApp directive was defined.



No comments: