Strange change of page on success function

I’ve page (app.photo) of user profile where is possible upload and see photo uploaded.
When the photo are displayed if you click i’s possible to delete calling “delPhoto” 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, {ID_PHOTO:IDphoto, nome:name}).success(function(){viewPicture}).error(function(){alert("Foto non eliminata!")});
	return false
	}

function viewPicture() {
	$ionicLoading.show({template: 'Sto cercando le tue foto...'});
    $scope.photos = null;
	getPhoto.getData(function(dataResponse) {
    $scope.photos = dataResponse;
	});
	$ionicLoading.hide();
}

All works great (the img selected it’s deleted from the server) but on success function I would call viewPicture function (to refresh photo remaining on the server) but don’t work, and the page automatically changed on mainpage!
I try to add $state.go(“app.photo”) on success, but when execute the script go before on app.welcome page and then on app.photo! What wrong???