58-AngularJS-Form Validation-ngRoute-Routing-Single Page Application-Template-Templarurl-Service-03-03-2023
58-AngularJS-Form Validation-ngRoute-Routing-Single Page Application-Template-Templarurl-Service-03-03-2023
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min
.js"></script>
<body ng-app="">
<p>Try writing in the input field:</p>
<form name="myForm">
<input name="myInput" ng-model="myInput" required>
</form>
<p>The input's valid state is:</p>
<h1>{{myForm.myInput.$valid}}</h1>
</body></html>
<div ng-include="'myFile.htm'"></div>
1. <div ng-view></div>
2. <ng-view></ng-view>
3. <div class="ng-view"></div>
Applications can only have one ng-view directive, and this will be
the placeholder for all views provided by the route.
It will load the relevant data and HTML snippet instead of fetching the
entire HTML again and again.
When we are using ngRoute of AngularJS the browser does not make
any additional requests
90
R.Vijayani / Asso Prof / SITE / VIT
Creating custom angular service
Service method
This is instantiated with the new keyword.
It can be provided with an instance of the function passed to the service.
This object instance becomes the service object that AngularJS registers
and is injected to the required components.
Use this keyword to add properties and functions to this service object.
Unlike factory method, this does not return anything.
91
R.Vijayani / Asso Prof / SITE / VIT
The $http Service