$ state.current.name成为false或true,以保持他的名字

时间:2017-10-03 07:32:17

标签: javascript angularjs

在我的应用程序jhipster / angular中,我对我的内容进行了分页。当我点击更改当前页面时,它会执行$ state.transitionTo但我收到错误:

angular.js:13550 TypeError: stateName.indexOf is not a function
at isRelative (angular-ui-router.js:2299)
at findState (angular-ui-router.js:2307)
at Object.transitionTo (angular-ui-router.js:3158)
at Product_detailController.transition (product-detail.controller.js:379)
at fn (eval at compile (angular.js:14432), <anonymous>:4:260)
at expensiveCheckFn (angular.js:15485)
at Scope.$eval (angular.js:17229)
at angular.js:24056
at angular.js:26824
at forEach (angular.js:322)

我注意到$ state.current.self.name和$ state.current.name = false而不是&#34; product-detail&#34;。

enter image description here

有什么想法吗?

我的州.js:

.state('product-detail-detail', {
        parent: 'entity',
        url: '/product-detail-detail?page&sort&search&prod',
        data: {
            authorities: ['ROLE_USER'],
            pageTitle: 'eProductApp.product_detail.detail.title'
        },
        views: {
            'content@': {
                templateUrl: 'app/entities/product-detail/product-detail-detail.html',
                controller: 'Product_detailController',
                controllerAs: 'vm'
            }
        },
        params: {
            page: {
                value: '1',
                squash: true
            },
            sort: {
                value: 'id,asc',
                squash: true
            },
            search:null,
            prod: {
                value: null,
                squash: true
            }
        },
        resolve: {
            pagingParams: ['$stateParams', 'PaginationUtil', function ($stateParams, PaginationUtil) {
                console.log($stateParams);
                return {
                    page: PaginationUtil.parsePage($stateParams.page),
                    sort: $stateParams.sort,
                    search: $stateParams.search,
                    predicate: PaginationUtil.parsePredicate($stateParams.sort),
                    ascending: PaginationUtil.parseAscending($stateParams.sort),
                    prod: $stateParams.prod
                };
            }],
            translatePartialLoader: ['$translate', '$translatePartialLoader', function ($translate, $translatePartialLoader) {
                $translatePartialLoader.addPart('product_detail');
                $translatePartialLoader.addPart('global');
                return $translate.refresh();
            }]
        }
    })

我在控制器中的功能.js:

function transition() {


        $state.transitionTo($state.$current, {
            page : vm.page,
            sort : vm.predicate + ',' + (vm.reverse ? 'asc' : 'desc'),
            search : vm.ppf,
            prod : vm.productid
        });

    }

0 个答案:

没有答案