A
A
Alexey Karpan2017-02-21 14:21:39
Angular
Alexey Karpan, 2017-02-21 14:21:39

pagination angular how to implement?

I am a beginner user of angular js, trying to figure out how to pass variables in pagination. I mastered the navigation itself as it is written here https://webref.ru/dev/angular-cookbook/routing
, everything is clear here, but I can’t find anywhere how to transfer information from page 1 to page 1-2 or deeper, something like bread crumbs. For example, on the main page there are 2 categories Car services and Restaurants. Clicking on Car Services takes me to a page with the heading Car Services and a list inside. Now deeper - I click on one of the car services inside the list and I get to the personal page of the car service. Here is such a simple example that needs to be implemented, I can’t find an example on the Internet, tell me what to read.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GTRxShock, 2017-02-21
@GTRxShock

I don’t want to seem overly categorical, but still I strongly recommend looking towards https://github.com/angular-ui/ui-router
They may have finished the native router now, but here everything is thought out to the smallest detail. You can just safely do nested states and other things, and automatic highlighting of the route tree out of the box.
here is a small example:

.state('app.discussions.categories.posts.new', {
    title: 'Создание нового обсуждения',
    url: "/new",
    views: {
        [email protected]': {
            controller: 'DiscussionCreateCtrl',
            templateProvider: function ($templateFactory) {
                return $templateFactory.fromCacheOrUrl('...../discussion-create.html');
            }
        },
    }
})

here we get the inheritance of urls, we automatically know which of the routing branches we are in.
Documentation is plentiful, you just need to start using it)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question