AngularJS Online Test Questions part 4

19. Which angular module is loaded by default?

a. ng
b. ng-app
c. ng-init
d. ng-start

Answer: a. ng

Explanation: The ng module is loaded by default when an AngularJS application is started. The module itself contains the essential components for an AngularJS application to function.


20. Which API need to be invoked on the rootScope service to get the child scopes?

a. new
b. $new

Answer: b. $new

Explanation: Child scopes are created using the $new() method


21. Which angular function is used to wrap a raw DOM element or HTML string as a jQuery element?

a. angular.element
b. angular.bootstrap
c. angular.module
d. angular.config

Answer: a. angular.element

Explanation: The angular.element function wraps a raw DOM element or an HTML string as a JQuery element if JQuery is available, otherwise, it defaults to using Angular's JQuery lite which is a subset of JQuery.


22. Can '$scope' be injected while creating service using 'factory' method?

a. Yes
b. No

Answer: b. No

Explanation: No, the '$scope' cannot be injected while creating service using 'factory' method.


23. AngularJS needs data in which format to populate its model?

a. XML
b. JSON
c. TXT
d. JS

Answer: b. JSON

Explanation: AngularJS needs data in JSON format to populate its model.


24. What acts as glue between controller and view?

a. ng-model
b. $rootScope
c. $Scope
d. ng-bind

Answer: c. $Scope

Explanation: Scopes define the accessibility of a javascript variable. Scopes are objects that refer to the model. The '$scope' acts as glue between controller and view. Scopes are objects that refer to the controller and to the views.