AngularJs Interview Questions and Answers Part 3

1. How to include html content in AngularJs Application?
Ans. using ng-include directive

Example:

<body ng-app="TestApp">

<div ng-include="'index.htm'"></div>

</body>

2. Which directive is used to set disabled attribute of an Html element in AngularJs?
Ans. ng-disabled

3. Which directives are used to show/hide html elements in AngularJs?
Ans. The ng-show and ng-hide directives are used.

4. $http service object response contains which properties in AngularJs?
Ans. .config,.data,.status,.statusText,.headers

5. What is the difference between the following codes in AngularJs?
var app = angular.module("TestApp", []);
and 
var app = angular.module("TestApp");

Ans. The first one is creating the module and the second is calling the module.
Since we are not passing any parameters so it will call the module with that name instead of
creating new one.

6. To clone HTML elements once for each item in a collection which directive is used in AngularJs?
Ans. ng-repeat

7. In how many ways we can invoke the directive in AngularJs?
Ans. we can invoke the directive in following ways,
1.Element name
2.Attribute
3.Class
4.Comment

8.How to restrict the directive to be invoked only at class level in AngularJs?
Ans. By using restrict='C' property.

9. What is the default value for 'restrict' property in AngularJs?
Ans. By default the value is EA which means both Element names and Attributes can invoke.

10. What are the values for restrict property in AngularJs?
Ans. The following are the restrict values applicable :
E - Element name
A - Attribute
C - Class
M - Comment


 



Subscribe

Receive Quality Tutorials Straight in your Inbox by submitting your Email below:

Delivered by FeedBurner

Protected by Copyscape Duplicate Content Checker