Angular is a single page application framework developed by Google and is one of the more mainstream one-page application frameworks. The powerful place has many, such as two-way data binding, applying the back-end MVC pattern to the front end, custom directives, and so on.
Since it is a single page application, it is definitely inseparable from the page switch. Let's start with the angular route.
Angular to achieve page switching using the route.
<script src= "Js/plugins/angular/angular.min.js" ></script>
Angular.min.js to be loaded before angular-ui-router.min.js. And then we're going to sign up in app.
(function () {
angular.module (' demo ', [
' Ui.router ',
])
After registration, you need to configure route.
function config ($stateProvider, $urlRouterProvider, $httpProvider) {
$urlRouterProvider. Otherwise ("/home/get") ;
$stateProvider
. State (' login ', {
URL: "/login",
templateurl: "). /views/login.html ",
})
. State (' home ', {
abstract:true,
URL:"/home ",
templateurl:" views/ Common/content.html ",
})
. State (' Home.get ', {
URL:"/get ",
templateurl:" Views/get.html ",
data: {pagetitle: ' Example View '}
}
. State (' Home.post ', {
URL: "/post",
templateurl: "views/post.html",
data: {pagetitle: ' Example View '}< c21/>});
App = Angular.module (' demo ');
Configuration is over here. Each State in the configuration is a view that represents a page, the page jumps with state, and the corresponding HTML file is in the templateurl corresponding file.
The above is a small set to share the ANGULARJS in the use of route and configuration of the relevant knowledge, hope to help you.