Skip to main content
edit
Source Link
Pankaj Parkar
  • 136.3k
  • 23
  • 241
  • 307

You should use, like .product will tell router that I want to go in child state & will pass slug value.

ui-sref=".product({slug: 'some-product'})"

But technically you should not have parameter slug in both child and parent state. because when you want to directly navigate to child state at that time whole thing will get messed up.

Like when you do shop.category.product({slug: 'some-cat', slug: 'some-product'}) at that time you can have slug property in same json, javascript wouldn't get compile correctly.

So I'll suggest you have different name on each state for slug parameter like below

.state('shop', {
        url: '/shop'

.state('shop.category', {
        url: '/:catslug'

.state('shop.category.product', {
        url: '/:productslug'

You should use, like .product will tell router that I want to go in child state & will pass slug value.

ui-sref=".product({slug: 'some-product'})"

But technically you should not have parameter slug in both child and parent state. because when you want to directly navigate to child state at that time whole thing will get messed up.

You should use, like .product will tell router that I want to go in child state & will pass slug value.

ui-sref=".product({slug: 'some-product'})"

But technically you should not have parameter slug in both child and parent state. because when you want to directly navigate to child state at that time whole thing will get messed up.

Like when you do shop.category.product({slug: 'some-cat', slug: 'some-product'}) at that time you can have slug property in same json, javascript wouldn't get compile correctly.

So I'll suggest you have different name on each state for slug parameter like below

.state('shop', {
        url: '/shop'

.state('shop.category', {
        url: '/:catslug'

.state('shop.category.product', {
        url: '/:productslug'
Source Link
Pankaj Parkar
  • 136.3k
  • 23
  • 241
  • 307

You should use, like .product will tell router that I want to go in child state & will pass slug value.

ui-sref=".product({slug: 'some-product'})"

But technically you should not have parameter slug in both child and parent state. because when you want to directly navigate to child state at that time whole thing will get messed up.