我有这个页面(app.photo),用户可以上传和查看照片。 单击视图按钮调用此功能:
$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
}
我的问题是,当功能成功,页面改变(自动转到app.welcome),所以我添加$ state.go('app.profilo'),但这会导致不良影响(首先转到应用程序。欢迎,而不是app.photo)。 是否可以刷新视图app.photo ????
答案 0 :(得分:0)
好的,我解决了......我在一个href中点击(或暂停它)!我真笨! 但是现在我还有另外一个问题......成功之后我会去视图中的标签。 这是我的页面代码:
<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>
当我调用ng-click“setPhoto()”时,我在名为“FOTO”的标签上。在成功setPhoto之后,我会去名为“I MIEI DATI”的标签。 有可能吗?