Angular uses routing and $ location to switch the view, angularlocation
Angular's $ route service can be used to define a specific URL that the browser directs to. angular loads and displays a template and instantiate a controller to provide content for the template.
In applications, you can call functions on the $ routeProvider service to create a route, and pass the route to be created as a configuration block to these functions. The pseudocode is as follows:
Copy codeThe Code is as follows:
Var someModule = angular. module ('somemodule', [... module dependencies...])
SomeModule. config (function ($ routeProvider ){
$ RouteProvider.
When ('url', {controller: aController, templateUrl: '/path/to/template '}).
When (... other ...).
Otherwise (... what to do ...);
});
The method is simple and the code is concise, but it is very practical. I hope my friends will like it.