Q1 . What is an Alternative to ng-init in AngularJS?
SOLUTION
Instead of creating expression in the Application directly we can create all the expression values in the controller and display them in the view
We can even bind elements to expression ,so that when the value is computed inside the controller the element will display the value.
Q2 . How to create a module in AngularJS?
SOLUTION
We can create module of the name appname in the following way
var app=angular.module("appname",[])
Q3 . How to create a controller in AngularJS?
SOLUTION
We can create a controller for the Application appname app.controller('appname', function($scope) {}.
Q4 . How to initiate Angular JS application?
SOLUTION
Whichever element has the ng-app directive that is the scope of the angular JS application.<div ng-app='myapplication'></div>
Q5 . Can we have multiple applications in a single page in AngularJS?
SOLUTION
We can have multiple angular application in the same page .Just use the ng-app directive in different hierarchy of elements.
Q6 . what is data binding in AngularJS?
SOLUTION
Data binding is binding the way binding an element to a HTML element.Whenever the value of the angular expression is changed it reflects in the bound HTML element.
<h1 ng-bind="name"></h1>
Whenever there is a value for name in the angular application it will reflect in the h1 element.
Q7 . what is the use of ng-app in AngularJS?
SOLUTION
It is used to define the scope of an Angular application in a page.
Q8 . what is the use of ng-model in AngularJS?
SOLUTION
ng-model is also similar to ng-bind to provide data binding but it can provide data binding for form element .The data binding can be one way or two and fro.
The change on either side reflect on the other side model and the view.
Q9 . what is the use of ng-binding in AngularJS?
SOLUTION
It is used to bind a specific element to the expression in angular expression and the value of the element will change as the expression value changes.
Q10 . what is the use of ng-repeat in AngularJS?
SOLUTION
This is used to repeat a certain element n number of times depending on the logic.