Currently facing an issue with a single-page application built using AngularJS. The app is composed of three main views - the login view, main view, and logout view.
- myapp/#/login
- myapp/#/main
- myapp/#/logout
This is my route provider setup:
function Router($routeProvider) {
$routeProvider
.when('/login', {
templateUrl: 'app/components/login/login.tmpl.html',
controller: 'login.ctrl',
controllerAs: 'vm'
})
.when('/main', {
templateUrl: 'app/components/dashboard/main.tmpl.html',
controller: 'dashboard.ctrl',
controllerAs: 'vm'
})
.when('/logout', {
templateUrl: 'app/components/logout/logout.tmpl.html',
controller: 'logout.ctrl',
controllerAs: 'vm'
})
.otherwise({
redirectTo: '/login'
});
}
Scenario: 1) User logs in. 2) User navigates to the main view to access content. 3) User decides to log out. 4) Confirmation for log out is displayed on the logout view. 5) Upon confirmation, user is redirected back to the login view.
However, upon reaching the login view, clicking the browser's back button leads back to the main view instead of staying on the login view. Is there a way to adjust this behavior specifically for the login view? Any suggestions or insights are greatly appreciated!