Q & A - Angular Questions & Answers

 

Q&A 1.

What is Angular?

Angular js is a javascript framework developed by Google. It is used to build Single Page Application (SPA) applications. And it extends HTML DOM with additional attributes and makes it more responsive to user actions.

Q&A 2.

What are Angular js Directives?

AngularJS directives are HTML attributes with an ng prefix. 

Q&A 3.

How to include Angular js directives in html?

AngularJS extends HTML with ng-directives. Such as ng-app, ng-model and ng-bind.

Q&A 4.

What is ng-app and ng-controller attributes in angular?

The ng-app directive defines an AngularJS application and ng-controller defines a application controller.

Q&A 5.

What are AngularJS expressions?

AngularJS expressions are included in html using double braces where output is shown. AngularJS expressions bind AngularJS data to HTML the same way as the ng-bind directive.

<p>{{name}}</p>

Q&A 6.

What is difference between ng-bind and ng-model?

The ng-bind directive binds the content of any html element to the application variable name just like angular expressions. While ng-model use to bind the input field to application variable name.

<p>Name: <input type="text" ng-model="name"></p>
<p ng-bind="name"></p>

Q&A 7.

What are Angular modules and controller?

Angular js modules define the applications while angular js controllers control applications.
In Model View & Controller (MVC) "C" is the controllers.

Q&A 8.

How does angular binds data to html?

AngularJS expressions are used to bind data to html they are much like JavaScript expressions. They can contain literals, operators, and variables.

{{x + y}} Or {{UserName}}

Q&A 9.

How to include angular in a Html page?

Add the angular js library inside html head section and include ng-app directive in html div. Also use ng-app to define module in angular.

<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
 
});
</script>

Q&A 10.

What does the ng-init attribute will do?

Attribute ng-init will initializes values and evaluates an expression in a current scope.

<div ng-init="count = x + 1" >
<p>{{count}}</p></div>


Use ng-controller to initialize values rather necessary in ngInit.


Related Quiz Content

x
This website is using cookies to make user experience of the site better. More info. OK