For my current project, I have implemented the use of angular $routeProvider for page navigation. To navigate back, I am using javascript.go(-1). However, a problem arises when clicking the back button as it reloads and re-renders all the data. Is there a way to retain the previous state when using javascript.go(-1)?
app.config(function ($routeProvider, localStorageServiceProvider) {
$routeProvider
.when('/api/lecturer/', {
templateUrl: 'partials/dashboard.html',
controller: 'dashboardController'
})
.when('/account/lecturer/project/', {
templateUrl: 'part/lecturer_project.html',
controller: 'projectController'
}).otherwise({redirectTo: '/login'});})
HTML:
<li>
<a onclick="javascript:history.go(-1);" style="cursor:pointer;" class="button">back
<i class="entypo-left-dir right"></i>
</a>
</li>