angularjs - Prevent change state (page) in ionic -
i've page (app.photo) user upload , view photo. clicking view button call function:
$scope.delphoto = function(idphoto,name) { $ionicloading.show({template: 'elimino la foto...', duration:500}); $http.post('http://www.digitalxp.it/public/speedjob/del_img.asp?nome='+name).success(function(data, status, headers){ alert("foto eliminata"); $state.go('app.profilo'); $http({method: 'get', url: 'http://www.digitalxp.it/public/speedjob/upjob.php?nome=amministratore'}).success(function(data){ $scope.photos = data; }).error(function(){ alert("error"); }); }).error(function(){ alert("foto non eliminata!")}); return false }
my problem when function success, page change (go automatically app.welcome), add $state.go('app.profilo') cause bad effect (first go app.welcome , app.photo). possible refresh view app.photo????
ok solved.... make ng-click (or on-hold it's same) in href! i'm stupid! i've problem... after success go tab inside view. page code:
<ion-view title="profilo" ng-controller="loadprofilo"> <ion-nav-buttons side="left" > <button menu-toggle="left" class="button button-icon icon ion-navicon"></button> </ion-nav-buttons> <ion-nav-buttons side="right" > <button menu-toggle="right" class="button button-icon icon ion-chatbubbles"></button> </ion-nav-buttons> <ion-tabs tabs-type="tabs-icon-only" class="tabs-icon-top tabs-dark"> <ion-tab title="i miei dati" icon-on="ion-person-add" icon-off="ion-person"> <ion-content has-header="true" padding="true"> <h2>i miei dati</h2> <div class="list card"> <div class="item item-avatar"> <img ng-src="http://www.digitalxp.it/public/speedjob/users/amministratore/{{profilo.photo_url}}"> <h1>{{profilo.name}} </h1> <p>{{profilo.anni}} anni</p> </div> <div class="item item-body"> <p>nome: <b>{{profilo.nome}}</b></p> <p>cognome: <b>{{profilo.cognome}}</b></p> <p>città : {{profilo.city}} <b>({{profilo.provincia}})</b></p> <p> {{profilo.desc}} </p> </div> </div> </ion-content> </ion-tab> <ion-tab title="foto" icon-on="ion-social-instagram" icon-off="ion-social-instagram-outline"> <ion-content has-header="true" padding="true" ng-controller="cameractrl"> <h2>mettici la faccia</h2> <p>scegli una foto oppure scattane subito una per farti conoscere dagli utenti della community!</p> <div class="button-bar"> <a class="button" ng-click="takepicture();">scatta</a> <a class="button" ng-click="selectpicture();">scegli</a> <a class="button" ng-click="viewpictures();">vedi</a> </div> <div ng-show="picdata" class="item item-image"><img id="myimage" class="item" ng-src="{{picdata}}" ng-click="uploadpicture();" style="height:200px;"/></div> <div class="home-sq"> <div ng-repeat="photo in photos" ng-click="setphoto($index, photo.name, profilo.user_id)" on-hold="delphoto($index, photo.name)" style="background-image:url({{photo.file}});background-size:120% auto"> </div> </div> </ion-content> </ion-tab> <ion-tab title="abilita'" icon-on="ion-ios7-cog" icon-off="ion-ios7-cog-outline"> <ion-content has-header="true" padding="true"> <h2>le mie abilita'</h2> </ion-content> </ion-tab> </ion-tabs> </ion-view>
when call ng-click"setphoto()" i'm on tab named "foto". go, after success setphoto, tab named "i miei dati". possible?
Comments
Post a Comment