Angular 添加路由

var app=angular.module('kaifanla',['ng','ngRoute']);
app.config(function($routeProvider){
//添加路由
$routeProvider
.when('/文件名',{
templateUrl:'tpl/start.html',
controller:'startCtrl'
})
.when('/文件名',{
templateUrl:'tpl/main.html',
controller:'mainCtrl'
})
.when('/文件名',{
templateUrl:'tpl/detail.html',
controller:'detailCtrl'
})
.when('/文件名/:id',{
templateUrl:'tpl/detail.html',
controller:'detailCtrl'
})
.when('/文件名',{
templateUrl:'tpl/order.html',
controller:'orderCtrl'
})
.when('/文件名/:id',{
templateUrl:'tpl/order.html',
controller:'orderCtrl'
})
.when('/文件名',{
templateUrl:'tpl/myOrder.html',
controller:'myOrderCtrl'
})
.otherwise({redirectTo:'/文件名'});
});
posted @ 2017-08-04 12:04  ThisCall  阅读(690)  评论(0编辑  收藏  举报