I am using the ngRouter and I am having in issue with the code below:
# Add Video
.when '/videos/:action',
templateUrl: 'app/videos/videos-edit/videos-form.html'
controller: 'VideosEditCtrl'
authenticate: true
# Edit video
.when '/videos/:action/:year/:month/:slug',
templateUrl: 'app/videos/videos-edit/videos-form.html'
controller: 'VideosEditCtrl'
authenticate: true
If I go to the edit video page above and I am not logged in, it redirects to the login page just like I want. However, if I do the same to the add video page, the url in the browser changes to the login page but it still shows the view for add video.
I can remove the authenticate:true from the add video controller and it seems to work by somehow still using the edit video authenticate but I am not sure why or how.
I want to use one controller for adding and editing a video since the code is so similar. Am I doing something wrong with my routing? Should I split the controller up?