2015-05-08 109 views
0

我有一个用ui路由器设置的父/子方案,我似乎无法让它“去”。抛出没有错误,并似乎符合这些例子。UI路由器更改URL但不更改模板/控制器

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功能双击。我可以把它加载成不是一个孩子的路线,但作为一个孩子,它非常生气。

<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> 
+1

是否在您的customers.html中添加了? –

+0

谢谢,我只是这样做,它似乎工作,但后退按钮不再让我回到以前/客户的路线。它仍然显示/编号路线 – dkran

+0

好工作马克我的答案被接受。对于后退按钮或历史记录,您必须启用htmls模式。 –

回答

2

在您的customers.html文件中添加<ui-view >

相关问题