Ionic switch between tabs with parameters -


i have app tabs, first tab show latest post , input search user can filter results.

when user makes search, want switch second tab, manage search , display results. want keep first tab showing latest post.

the code switching second tab is:

    $scope.search_posts = function() {         if ( !angular.isundefined($scope.searchtext) && $scope.searchtext.length > 2 ) {             $scope.searchtext      = '';             $scope.show_search_box = false;             $ionictabsdelegate.select($ionictabsdelegate.selectedindex() + 1);         } else {             $ionicloading.show({ template: 'you must write @ least 3 characters long.', nobackdrop: false, duration: 2000 });         }     } 

...but not know how send 'searchtext' parameter when switching.

how can accomplish this?

you use $rootscope store shared data:

$scope.search_posts = function() {     if ( !angular.isundefined($scope.searchtext) && $scope.searchtext.length > 2 ) {         $rootscope.searchtextfromtabone = $scope.searchtext;         $scope.searchtext = '';         $scope.show_search_box = false;         $ionictabsdelegate.select($ionictabsdelegate.selectedindex() + 1);     } else {         $ionicloading.show({ template: 'you must write @ least 3 characters long.', nobackdrop: false, duration: 2000 });     } }  //in tab two's controller $scope.searchtext = $rootscope.searchtextfromtabone; 

Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -