2种方式:
第一种:
index.html
<ui-view></ui-view>
对应路由
$stateProvider
.state('first', {
url: '/first',
templateUrl: 'views/first/first.html',
controller: 'firstCtrl'
})
.state('task', {
url: '/task',
templateUrl: 'views/task/taskList.html',
controller: 'customersCtrl'
});
$urlRouterProvider.otherwise('first')
第二种:
index.html
<div ng-view> </div>
对应路由
$routeProvider
.when("/login", {
url: "/login",
templateUrl: "views/login/login.html", //第一个显示出来的页面
controller:'loginController'
})
.when("/task", {
url: "/task",
templateUrl: "views/task/taskList.html", //第一个显示出来的页面
controller:'taskController'
})
.when("/checkPatient", {
url: "/checkPatient",
templateUrl: "views/checkPatient/checkPatient.html", //第一个显示出来的页面
controller:'checkPatientController'
})
.otherwise("/login");