Sign in
Log inSign up
Angular UI-Router optional url parts

Angular UI-Router optional url parts

Matan Yedayev's photo
Matan Yedayev
·Feb 27, 2016

Use 2 states and that's it.

100%

Else...

0%

7 votes · Closed

I wonder how to make 1 state with 2 urls options: /dashboard & /dashboard/verification/:verificationToken

Thats my state code:

.state('app.dashboard', {
    url: '/dashboard',
    controller: 'DashboardController',
    templateUrl: 'src/components/app/dashboard/dashboard.html'
})

I know the simplest solution is to make 2 states: app.dashboard & app.dashboardWithVerification, but I think it's wrong way.

.state('app.dashboard', {
    url: '/dashboard',
    controller: 'DashboardController',
    templateUrl: 'src/components/app/dashboard/dashboard.html'
})
.state('app.dashboardWithVerification', {
    url: '/dashboard/verification/:verificationCode',
    controller: 'DashboardController',
    templateUrl: 'src/components/app/dashboard/dashboard.html'
})

Any idea? Thanks.