Hi All,
I would ask if it is possible to hide or show popup when navigating from a different view?
Example :
In view 1, popup 1 is shown. However, when navigating from view 2 to view 1 by a button, popup 2 will show and popup 1 will hide.
Thank you
Hi @AY2021S1 ,
the popup is a widget of the View-> and is not generic dialog finction. So means that you can show the popup widget only when the view is displayed where the popup belogns to.
What we can do:
-create a duplicate copy of the popup for each view where it should be shown. You can use some automatic function when you navigate:
$scope.goToViewPopup(viewName, popupName){
twx.app.fn.navigate(viewName);
$scope.$applyAsync();//not required
$timeout($scope.$root.$broadcast('app.view["'+viewName+'"].wdg["'+popupName+'"].svc.showpopup'),500);//delay to be ensure that view is loaded value to be optimized after tests
}
in case that you want to use the view menu to change /select the view. Then you can use Event callback:
$scope.$on('$ionicView.afterEnter', function () { //when 2d view is intilized
console.log("ionicView.afterEnter event called !")
$scope.$applyAsync();
$timeout($scope.$root.$broadcast('app.view["TestView"].wdg["popup-1"].svc.showpopup'),500);
});
The example above is view specific. So means the code e.g. for the view "TestView" and it should be pasted in TestView.js -> this means therefore the view name could be hardcoded!
The name of the popup could be also hardcoded but also could be red from parameter name e.g. POPUPNAME:
$timeout($scope.$root.$broadcast('app.view["TestView"].wdg['+$scope.app.params['POPUPNAME']+'].svc.showpopup'),500);