ANGULARJS supports single-page applications through multiple views on a single page. To do this angularjs provides Ng-view and ng-template instructions, as well as $routeProvider services.
Ng-view
Open view, just a placeholder, no value example:<div ng-view></div>
Ng-template
Create a view, with the script tag, type ng-template, containing an id attribute for the $routeprovider mapping control, ID pointing to an HTML page
$routeProvider
The configuration of the main URL is a angular object that maps them to the appropriate HTML page or ng-template
Use
var app = Angular.module ("app", [' Ngroute ']); App. Config ([' $routeProvider ', function ($routeProvider) { $routeProvider. When ('/addstudent ', { templateurl: ' addstudent.html ', controller: ' Addstudentcontroller ' }). When ('/viewstudents ', { templateurl: ' viewstudents.html ', controller: ' Viewstudentscontroller ' }). Otherwise ({ redirectto: '/addstudent ' ); }]);
Config is configured, the configuration item is an array, the parameter of the callback function is $routeprovider, the $routeprovider when method is used, parameter 1 is the request path, and parameter 2 is the object
Contains Templateurl to the controller for the view, otherwise to the default view, and if the page does not exist, the render view can be used as Template: (Label + content)
AngularJS views View