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:'/文件名'});
});
Angular 添加路由
转载本文章为转载内容,我们尊重原作者对文章享有的著作权。如有内容错误或侵权问题,欢迎原作者联系我们进行内容更正或删除文章。
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
Angular 路由复用策略
1. 前言用 Angular 路由实现的 Tab 切换,当在不同 Tab 之间切换时,希望保留 Tab 中的状态,这时就需要用到路由复用策略 `RouteReuseStrategy`。用 上
Angular 路由复用策略 RouteReuseStrategy ide 复用