Whenever a value is assigned to the variable1 in a controller the value will get reflected in the paragraph tag.
Q2 . What are classes of ng-model?what are some of classes of ng-model in AngularJS?
SOLUTION
The ng-model provides some classes that are set or removed based on the state of certain HTML elements.Some of the classes are -
ng-valid
ng-empty
ng-touched
Q3 . Can we have multiple controllers in AngularJS?
SOLUTION
We can have multiple controller like
since we can multiple application and modules
We can similarly have multiple controller to reduce dependency and increase modularity.
Q4 . What is a $scope variable in AngularJS?
SOLUTION
$scope is an object of a controller and usually gives access to the properties inside the angular application to which the controller is assigned.
Q5 . What is a $rootscope variable in AngularJS?
SOLUTION
$rootscope gives access to all the properties across different parts of an application.
Q6 . How to add filter to a field in AngularJS?
SOLUTION
{{ student
uppercase }}
In the above given expression uppercase is the filter.The value of student will be formatted to uppercase.
Q7 . What is a service in AngularJS?
SOLUTION
A service is like a small code that can be invoked when require inside our ng-app or Angular application.some examples of services are
$http
$location
$interval
Q8 . What does $http service do in AngularJS?
SOLUTION
The $http service is used to make a request to a server and the response is received by the application.
Q9 . What does $timeout service do in AngularJS?
SOLUTION
$timeout service is literally used to cause a timeout.For example if we want a specific task to be performed after sometime then we can use the timeout service.
Q10 . What does $location service do in AngularJS?
SOLUTION
$location is used to get the address of the page in the application.The changes in the URL gets reflected in the $location.