How to dynamically add page slug?


#1

i am developing a app . It considts of 2 pages

page1 .html and page2.html

there are 10 products in page1.html each item has a unique page slug if i click a item it should pass the value along the slug and details must be displayed in page2.html . Can someone help me how can i achieve it ??


#2

Hi samxfido88,

For achieving your goal you need to take help of $stateProvider

 .state('tab.product-detail', {
      url: '/chats/:slug/:productId',
      views: {
        'tab-producy': {
          templateUrl: 'templates/product-detail.html',
          controller: 'ProductDetailCtrl'
        }
      }
    })

You need to add that slug and if any specific id is there for product then that too. Something like displayed in above mentioned code. after that you need to add that slug and id in the product list page where you are specifying the link something like displayed below

href="#/tab/products/{{product.slug}}/{{product.id}}"

Hope this will help you resolving your issue.!! :slight_smile: