0

I have a website by mean-stack.

I want to add a web page https://localhost:3000/A. This page contains a textarea where people could write a text, it also contains a button go forward to Page B. Thus clicking on the button leads to https://localhost:3000/B. Page B prints the text (which can not be edited) that was written in Page A. It also contains a button go back to Page A, which leads back to Page A.

When we click on go back to Page A, I don't want the browser to reload https://localhost:3000/A (ie, execute all the functions in resolve) ; I just want to go back to the previous state of Page A (with previous text) right before going to Page B.

Does anyone know how to achieve this?

PS: Page A and Page B have different controllers. Additionally, for some reasons I can NOT enable html5mode in my website.

$stateProvider
    .state('A', {
        url: '/A',
        templateUrl: 'A.html',
        controller: 'ACtrl'
    }
    .state('B', {
        url: '/B',
        templateUrl: 'B.html',
        controller: 'BCtrl'
    }

Edit 1: I tried this solution. The back button did lead to previous page, which was however reloaded, that's not what I want.

SoftTimur
  • 5,630
  • 38
  • 140
  • 292
  • 1
    There shouldn't be two URLs/states for these two "pages". It makes no sense, for example, to be able to navigate to B without going to A before. Just use ng-if to hide A and show B (or vice versa), in a single router state. – JB Nizet Jan 06 '18 at 08:57
  • @JBNizet I see what you mean... Do you have any idea about [this question](https://stackoverflow.com/questions/48126131/hide-a-monaco-editor)? – SoftTimur Jan 06 '18 at 09:48

0 Answers0