Sourav
Sourav

Reputation: 402

window.history.back() takes two clicks to go back

Here is my primary Route (route 1):

http://myportal.fakedomain.com:8080/src/#/dashboard

Now from this route, I'm going to a static route(using a button and sending query params) (route 2)

http://myportal.fakedomain.com:8080/src/#/my-table?group=Decision%20Gate&start_date=2020-06-01&end_date=2020-08-31

On this route page, I get a back button which should take me to the (route 1). But when i'm clicking on the back button the url got changed (following route) and it takes another click to go to the route 1. You see the date query param changes but the page not get refreshed.

http://myportal.fakedomain.com:8080/src/#/my-table?group=Decision%20Gate&start_date=Mon%20Jun%2001%202020%2000:00:00%20GMT%2B0600%20(Bangladesh%20Standard%20Time)&end_date=Mon%20Aug%2031%202020%2000:00:00%20GMT%2B0600%20(Bangladesh%20Standard%20Time)

Here is the view code

<md-button class="md-raised md-primary bck-btn margin-0" ng-click="vm.backToMM()">
      <md-icon md-font-icon="icon-arrow-back" class="font-size-fixed-14"></md-icon>
      <span class="v-mid margin-right-0"> Back </span>
</md-button>

Here is back function

vm.backToMM = function(){
    window.history.back();
}

Can anyone help me, how can I avoid clicking two times to go to the back. Here you don't need to bother about vm. I add "this" parent controller to this vm variable.

Upvotes: 1

Views: 767

Answers (0)

Related Questions