我正试图用UI路由器取代AngularJS路由,因为这似乎是每个人都使用的。我才刚刚开始,想知道如何用$stateProvider:替换以下代码
$routeProvider
.when('/login', {
templateUrl: 'views/login.html',
controller: 'LoginCtrl'
})
.when('/dashboard', {
templateUrl: 'views/dashboard.html',
controller: 'DashboardCtrl'
})
.otherwise({
redirectTo: '/login'
});
用state
:替换when
$stateProvider
.state('state1', {
url: "/state1",
templateUrl: "partials/state1.html"
})
更多详细信息请点击此处:https://github.com/angular-ui/ui-router