When I navigate to the view, and then use the $location.path ("/path/origin") method to relocate to the initial page, after deep into the other view after the use of this method encountered a problem.
Assuming that this setting page is Viewa, if only from viewa-"VIEWB, then use the $location.path (' Viewa ') method to relocate back to Viewa without asking any questions. But if from viewa-"viewb-" VIEWC, viewc back to Viewa $location. Path (' Viewa '), the icon in the upper left corner of Viewa is not its original function button, which becomes the left arrow of the second figure as follows.
This is caused by the fact that the Web browser tracks only a single historical browsing record, while apps and WebApp require parallel independent histories, such as the VIEWB and viewc mentioned above, and we need both views to record the previous view as Viewa.
The first method:let VIEWC forget its own trail, add the following code to the VIEWC controller
$ionicHistory. nextviewoptions ({ true});
This is when you need to return from VIEWC to Viewa to use $location.path ("Viewa"), and the upper-left corner is no longer the left arrow. and print out $ionichistory.viewhistory () can be seen, at this time Viewa and the beginning of the Viewa Backview as null
If you do not add the above code to print the result is this:
Method Two: Return directly from VIEWC to Viewa
The GoBack method is described in the official Ionic documentation, as follows:
So, we can use this GoBack method directly in VIEWC, and return directly to Viewa in the browser's history stack:
$ionicHistory. GoBack (-2);
Print out the Viewa view history as above, Backview:null
summed up by the above method: if Viewa Backview has a value, then ionic will automatically set the upper left corner to the back button. In other words, man-made control backview so that we can get the results we want.
If the explanation is wrong, please leave a message.
Ionic: How to return to the previous view after multiple navigation