相关疑难解决方法(0)

angularJS:ui-router相当于$ location.search

我正在使用以下内容在我的数据网格中进行分页:

$location.search('page', page);
Run Code Online (Sandbox Code Playgroud)

其中page是当前页码.

然后我听以下事件:

   $scope.$on('$routeUpdate', function(next, current) {
            $scope.currentPage = $routeParams.page ? Number($routeParams.page) : 1;

            $scope.search();
        });
Run Code Online (Sandbox Code Playgroud)

在更新URL中的currentPage之后,触发对我的作用域上的search()方法的调用.

我如何将其转换为使用ui-router的状态?由于我使用状态管理器而不是路由,因此不再触发$ routeUpdate.

我的路由现在在州提供商中定义如下:

   $stateProvider
        .state('mandats', {
            url: '/domiciliations/mandats',
            templateUrl: 'domiciliations/views/mandats.html',
            controller: 'mandatsCtrl'
        })
Run Code Online (Sandbox Code Playgroud)

angularjs angular-ui

3
推荐指数
1
解决办法
2043
查看次数

标签 统计

angular-ui ×1

angularjs ×1