我有以下文件:
index.html
car.html
truck.html
mainCtrl.js
carCtrl.js
truckCtrl.js
并希望建立这样的路线:
#/search (template: index.html, controller: mainCtrl.js)
#/search/car (template: car.html, controller: carCtrl.js)
#/search/truck (template: truck.html, controller: truckCtrl.js)
index.html包含两个链接,一个必须重定向到#/search/car
,第二个:#/search/truck
car.html & truck.html
必须加载 nested view
请有人帮我完成这项任务
我猜像这样的东西可以解决问题。
$stateProvider
.state('search', {
url: '/search',
controller: 'mainCtrl',
templateUrl: '/path/to/index.html',
})
.state('search.car', {
url: '/car'
controller: 'carCtrl',
templateUrl: '/path/to/car.html',
})
.state('search.truck', {
url: '/truck'
controller: 'truckCtrl',
templateUrl: '/path/to/truck.html',
})
将ui-view标记放在索引部分中的某个位置。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句