UI路由器我使用下面做寻呼我的DataGrid:
$location.search('page', page);
其中页是当前页码。
然后我听以下事件:
$scope.$on('$routeUpdate', function(next, current) {
$scope.currentPage = $routeParams.page ? Number($routeParams.page) : 1;
$scope.search();
});
,更新的当前页是在URL后触发调用我的范围search()方法。
我该如何将它转换为使用ui-router的状态? $ routeUpdate不再被触发,因为我使用的是状态管理器而不是路由。
我的路线现在的状态提供者定义为这样:
$stateProvider
.state('mandats', {
url: '/domiciliations/mandats',
templateUrl: 'domiciliations/views/mandats.html',
controller: 'mandatsCtrl'
})
什么是$ stateProvider? – Langdon 2013-04-29 15:45:13
它是AngularJS的ui-router插件的一部分。它提供状态管理。 – Sam 2013-04-29 15:59:53