$ routeProvider中的多个URL [英] Multiple url in $routeProvider
本文介绍了$ routeProvider中的多个URL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想为$ routeProvider重定向多个URL.我该如何应用?例如,我正在尝试这样,
I want to redirect multiple url for $routeProvider. How can I apply this? For example, I am trying like this,
.when('/laptop' || '/mobile', {
templateUrl: '/Selection_Routing/Selection_Product/ProductDetails.html',
controller: 'ProductDetailsController'
})
请注意,我想重定向/laptop或/mobile网址,但无法正常工作.有什么建议吗?
Please note that I want to redirect either /laptop or /mobile url, but it is not working. Any suggestion?
推荐答案
我使用UI Router做类似的事情.
I do something similar with UI Router.
var sameURL = "laptop,mobile,foo,bar".split(",");
angular.forEach(sameURL function(route) {
.state(route, {
url: "/" + route,
templateUrl: "views/home.html"
})
})
您应该能够轻松地对此进行调整.
You should be able to adapt this easily.
这篇关于$ routeProvider中的多个URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文