UI 路由器更改 URL 但不更改模板/控制器
UI router changing URL but not changing template / controller
我用 ui 路由器设置了 parent / child 方案,但我似乎无法将其设置为 "go"。没有抛出任何错误,并且似乎符合示例。
app.config.js:下$stateProvider
.state('customers', {
url:'/customers',
templateUrl: 'app/customers/customers.html',
controller: 'customerCtrl'
})
.state('customers.detail', {
url: '/:id',
parent: 'customers',
templateUrl: 'app/customers/detail/detail.html',
controller: 'customerDetail'
})
我有那两条路线。
customerCtrl.js:
$scope.rowDblClick = function(row){
$state.go('customers.detail', {id: row.entity.customer_id})
}
在我的 ui-grid
双击功能中。我可以让它加载不是 child 路线,但作为 child 它非常生气。
<div ui-view>
<div class="routeHeader">
Customer Listing
</div>
<button class="button-small newCustomer" ng-click="newCustomer()">New Customer</button>
<div class="row">
<div class="large-12 cols" ui-grid="gridOptions" ui-grid-selection>
</div>
</div>
</div>
在您的 customers.html 文件中添加 <ui-view >
。
我用 ui 路由器设置了 parent / child 方案,但我似乎无法将其设置为 "go"。没有抛出任何错误,并且似乎符合示例。
app.config.js:下$stateProvider
.state('customers', {
url:'/customers',
templateUrl: 'app/customers/customers.html',
controller: 'customerCtrl'
})
.state('customers.detail', {
url: '/:id',
parent: 'customers',
templateUrl: 'app/customers/detail/detail.html',
controller: 'customerDetail'
})
我有那两条路线。
customerCtrl.js:
$scope.rowDblClick = function(row){
$state.go('customers.detail', {id: row.entity.customer_id})
}
在我的 ui-grid
双击功能中。我可以让它加载不是 child 路线,但作为 child 它非常生气。
<div ui-view>
<div class="routeHeader">
Customer Listing
</div>
<button class="button-small newCustomer" ng-click="newCustomer()">New Customer</button>
<div class="row">
<div class="large-12 cols" ui-grid="gridOptions" ui-grid-selection>
</div>
</div>
</div>
在您的 customers.html 文件中添加 <ui-view >
。