I have three pages (A, B and C) in my Ionic4 application. Page C has an ion-back-button.
I'm trying to implement the following navigation flow (using Angular router and the ion-back-button):
A -> B -> C, and then navigating back from C to A.
When I press the ion-back-button at C, the application navigates back to B, as it was the previous page.
¿How can I navigate back from C to A when I press the ion-back-button?
you can do it using events
https://ionicframework.com/docs/api/util/Events/
in page C use the method willLeave https://ionicframework.com/docs/api/navigation/ViewController/#willLeave
inside the willLeave trigger an event example: "user left C"
then in page B listen the event "user left C" and then use
this.navCtrl.pop();
you will go back to page A
Related
I am using vuetify 3.0.0-beta.9 and vue-router 4.1.5.
Stackblitz Demo
The routes are like
A
AB
X
XY
M
N
...
AB and XY are shown in VDialogs that have in the beginning modelValue true. their parents are shown below the child.
In case of the click:outside event of a VDialog I call $router.back()
In case I click a close button inside I call $router.back()
If I route in this order: base -> A -> AB -> XY
Then:
if I click outside I go back to AB
or if I click the close button I get a NavigationFailure.aborted
I also tried to call $router.back() somewhere else in the VDialog default slot with the same result
You can try to change the order you navigate - it is not limited to this order.
if I debug the history seems equal before $router.back() is called
I have a parent components, A, and child components B & C. I need to share a list between B & C, say a list of todos. Child C can add/delete an item in the todo list. Assume that the todo list is backed by an async service.
I have put together an app with A, B and C. My graph has the selected todo (set from a callback) atom and the list of current todos in its own atom. The current todo list is dependent on an id. When A mounts, I set a "id" from the URL (think routing). Since my views use the todo list recoil value, they get their list when its available.
When I click the delete button in C with a todo selected, I update the list on the server. But I want the recoil todo list to be refreshed after the request returns Ok that the todo was deleted. Or if I add a todo, I want to immediately add the todo to the list so its immediately viewable, add the todo on the server then fetch the todos in the background to refresh the recoil todo list.
How do I hand these last 2 parts in recoil?
Add a "version" or "successfully saved" recoil atom that can be used to trigger an update after data has been saved to the server. This will cause memory leaks though: https://github.com/facebookexperimental/Recoil/issues/422
Example,
I have a BottomTabNavigator stack having the tabs A and B.
The two tabs are themselves navigation stack comprising of the following routes.
A:
- A1
- A2
B:
- B1
- B2
At any point, my app should be able to navigate the user from any route(say B1 or B2) to a route of another stack (say A1 or A2). I am able to achieve this by adding the routes A1 and A2 to the stack of B, like as below
B:
-B1
-B2
-A1
-A2
I did this so that the routes of A are available to B in the same stack tree.
Even though I am able to achieve this, I wish to be able to navigate back to the route B2 (if I am navigating from B2 to A1, for example). But it's not happening; on pressing back from A1 route. I am not sure if this is the correct approach.
How can I control the navigation and make sure that I go back to the route of the previous stack where I came from.
The way I do this, I am not sure is this a right approach or not, But it works for me.
For example if you have two navigation screens
A and B
and inside A you have A1, A1 and inside B you have B1, B2.
You want to go from A1 to B1 and on the back press you want to return to A1.But as we can see you have declared B2 inside other stack, So when B1 loads, on its back press it returns to its parent stack navigator.
What you can do is, Declare B1 inside B as well as A.
Like this,
A:
- A1
- A2
- B1
- B2
B:
- B1
- B2
- A1
- A2
I am not sure weather this solution is efficient but it works for me for complex navigations.
I'm having a problem with nested controller like this
For example, I have controller A
class A extends Spine.Controller
events:
'click .foo' : 'handle_bar'
Then I create two instance of A like this
a = new A
b = new A
a.append b
When I click on .foo inside b, then b.handle_bar is called. But a.handle_bar is called as well.
How to prevent that problem?
Thanks!
because you end up nesting b inside of a with a.append b events that happen in b are also happening in a. It would probably be a bad idea for Spine controllers in general to stop propagation of events to prevent this, but you could implement that solution on b if you needed to.
In my Eclipse RCP application I have four views A, B, C, D. I want to display only A, B, C view at application start-up, and D view to be displayed when user click on button.
I am adding a view dynamically
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView("D_ViewID",null, IWorkbenchPage.VIEW_ACTIVATE);
this view is added at the bottom but I want this D view adjacent to B_View in such a way
my perspective code is here:
#Override
public void createInitialLayout(IPageLayout layout) {
String editor = layout.getEditorArea();
layout.setEditorAreaVisible(false);
IFolderLayout top=layout.createFolder("view",IPageLayout.TOP , 0.80f, editor);
top.addView(B.ID);
layout.addView(A.ID, IPageLayout.LEFT, 0.20f, BrowserView.B);
layout.addView(c.ID, IPageLayout.BOTTOM, 0.20f,editor);
}
You need to add a placeholder to the perspective, just like you added your already visible views. If you look at the top of the IPageLayout documentation, there is an example adding the bookmarks view as placeholder.