简体   繁体   中英

Dynamically change state url page number for pagination in angualrjs

how to change/add the state and url for pagination example

.state('result.({pageNumber:[0-9]{1,4}})', {
            url: '/{pageNumber:[0-9]{1,4}}',
            templateUrl: 'tpl/search_result.html'
        })

in html

<a ui-sref="result.{{pageNumber}} ">{{ pageNumber }}</a> 

Now the a html is added perfectly with pageNumber but in config.router.js I tried to increment the pageNumber. but I have no idea.

How to increment the pageNumber in state and URL

you mentioned state in wrong way. please use like this

.state('result.pageNumber', {
    url: '/:pageNumber',
    templateUrl: 'tpl/search_result.html'
  });

Change to this. you pass like this

<a ui-sref="result.pageNumber({pageNumber : pageNumber})">{{ pageNumber }}</a> 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM