On my application I have courses and events. There are two ways of showing events (which is the problematic state here):
One is by accessing this week's events ('events' state):
.state('events.show',
url: '/events/:eventId'
views:
'@':
templateUrl: '<%= asset_path('events/show.html') %>'
controller: 'EventCtrl'
resolve: { event: EventResolver }
)
The other when I select from a list of events scoped to course:
.state('courses.show.event',
url: '/events/:eventId'
views:
'@':
templateUrl: '<%= asset_path('events/show.html') %>'
controller: 'EventCtrl'
resolve: { event: EventResolver }
)
This really looks like a bad practice because of the duplication, but I'm not sure what should I do here instead, as I'd like to keep a "Back" button in the events/show.html
template to go back either to the scoped events list in course or back to this week's events depending where the user accessed the resource from.
Is there a better way of keeping the "Back" button going to where I wanted without all this duplication? Should I approach this differently?