AJSCHAPTER 3

 3.AngularJS Modules ,Controller ,View and Scope

 

1.What is  Scope Hierarchy in AngularJS?

2.What are the Angular Modules?

3.How to create a Controller in AngularJS?

4.What are the controllers in AngularJS?

5.Explain module life cycle.

6.How angular.module works ?

 

MCQ

 

1.AngularJS controllers control ___of AngularJS applications.

 a)the data

b)thefunction

c)the variable

 

2.Which directive defines the application controller?

a)ng-model

b)ng-ctrl

c)ng-controller

 

3.Which of the following service(s) will be invoked by the controller?

a)$scope

b)$http

c)$object constructor

d)$this

 

4.Controller is the link between the model and views.

a)True

b)False

 

5.Which directives bind the input fields to the controller properties?

a)data-ng-model

b)ng-app

c)ng-controller

 

6.In larger applications,controllers are stored in ___?

a)external files

b)scope object

c)internal files

 

7.Which statement is true about scope in AngularJS?

a)The scope is the binding part between the HTML (view) and the JavaScript (controller).

b)The scope is an object with the available properties and methods.

c)The scope is available for both the view and the controller.

d)All of the above

 

8.Controller, which is the JavaScript function that ___ the data?

a)Makes

b)Changes

c)Removes

d)All of the above

 

9.$rootScoperefers to an object which is accessible from everywhereoftheapplication.

a)True

b)False

 

10.$rootScope is created with ___

a)ng-controller

b)ng-app

c)ng-init

 

11.A controller is a JavaScript object containing ___

a)Attributes

b)Properties

c)Functions

d)All of the above

 

12.______ are used to separate logic such as services, controllers, applications etc.from the code and maintain the code clean.

a)the data

b)thefunction

c)the variable

d)Modules

 

13.Angular apps don’t have------- method.

a)main

b)view

 

14.---------is used to register ,create and retrieve previously created AngularJS Modules.

a)angular.module()

b)angular.controller()

 

15.What are Angular Controllers are responsible for

a)Controlling the data

2)displaying the data.

 

16.Which one of the following is correct syntax for creating a module in Angularjs?

a)Var myModule=angular.module();

b)Var myModule=new Module();

c)angular.module(“app”,[]);

 

17.How do you share data between controller and view ?

a)Using model

b)Using services

c)Using factory

d)Using $scope

 

18.angular .module is primarily used to create application module.

a)True

b)False.

 

19. Angularjs Controllers control ------ of AngularJS applications.

a)the data

b)the function

c)the variable

 

20.Scope contains the ------

a)Model data

b)JavaScript Objects

c)Variables.


 21. A controller is a JavaScript object Containing---------

a)Attributes

b)Properties

c)Functions

d)All of the above.