This article describes how to use routing and $ location to switch the view in angular. For more information about how to use angular's $ route service, see: angular loads and displays a template for a specific URL pointed to by the browser, and instantiates 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:
The 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.