zl程序教程

您现在的位置是:首页 >  前端

当前栏目

Angular 添加路由

Angular路由 添加
2023-09-11 14:17:23 时间
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:'/文件名'});
});