ionic framework - angularjs child state to get data for parent state -


i want implement child state getting data main state. while i'm in child state want show $ionicloading content on view of parent state , after data loaded should leave child state , go parent state. how implement using angularjs/ionicframework?

the controller state want split of looking this:

.controller('mainctrl', function ($scope, $ionicpopover, $state, $ionicloading, $ionicplatform, $q, webservice, dbservice) {    //------ part should go child state -----//   $ionicloading.show({     template: "daten werden geladen...",     animation: "fade-in",     showbackdrop: false,     maxwidth: 200,     showdelay: 500   });     $ionicplatform.ready(function() {      $ionicpopover.fromtemplateurl('templates/popover.html', {       scope: $scope     }).then(function (popover) {       $scope.popover = popover;     });      dbservice.droptables();      dbservice.createalltables();      webservice.getalltables().then(function(res) {        $ionicloading.hide();        $scope.refreshdestinations();       //data loaded leave child state      }, function(err) {        $ionicloading.hide();        //change state login       $state.go('app.login');      });   });   //----------- until here  -----------//    ... }); 

scope inherited, if want call parent scope function child can. example: ionic loading, if creates isolated scope (which may) may have call $parent.$ionicloading.show().

<div class="show-scope-demo">   <div ng-controller="greetcontroller">     hello {{name}}!   </div>   <div ng-controller="listcontroller">     <ol>       <li ng-repeat="name in names">{{name}} {{department}}</li>     </ol>   </div> </div>       angular.module('scopeexample', [])     .controller('greetcontroller', ['$scope', '$rootscope', function($scope, $rootscope) {       $scope.name = 'world';       $rootscope.department = 'angular';     }])     .controller('listcontroller', ['$scope', function($scope) {       $scope.names = ['igor', 'misko', 'vojta'];     }]); 

Comments

Popular posts from this blog

How has firefox/gecko HTML+CSS rendering changed in version 38? -

javascript - Complex json ng-repeat -

jquery - Cloning of rows and columns from the old table into the new with colSpan and rowSpan -