popover.html 内に ng-show を配置しようとすると、アプリがハングするという奇妙な問題が発生しています。コメントすると、アプリは正常に動作します。コード内で何がうまくいかないのか、本当にわかりません。
ここに私のpopover.htmlがあります:-
<ion-popover-view> <ion-content>
<div ng-show="showsettingButton()">
<ion-item menu-close ng-click="logout()"> Sign Out <span
class="item-icon-right"><i class="ion-chevron-right"></i></span> </ion-item>
<ion-item menu-close ui-sref="app.profile"> Settings <span
class="item-icon-right"><i class="ion-chevron-right"></i></span> </ion-item>
</div>
<div class="list" ng-repeat="title in Titlelist">
<a class="item"
ng-click="openpage(title.page_title,title.page_content)">
{{title.page_title}} </a>
</div>
</ion-content> </ion-popover-view>
ここにコントローラーの私の関数があります:-
app
.controller(
'MenuCtrl',
function($scope, LocalStorage, $stateParams, $rootScope,
$state, store, ngCart, $window, $ionicHistory,
DataService, $ionicLoading, $ionicPopup, $http,
$ionicSideMenuDelegate, $ionicPopover) {
$scope.showsettingButton = function() {
$scope.popover.hide();
if (LocalStorage.getData("userId")) {
if (LocalStorage.getData("userId") !== "undefiened") {
DataService.setbooleanIsUserLoggedIn(true);
} else {
DataService.setbooleanIsUserLoggedIn(false);
}
} else {
DataService.setbooleanIsUserLoggedIn(false);
}
return DataService.getbooleanIsUserLoggedIn()
}
$ionicPopover.fromTemplateUrl('templates/popover.html', {
scope : $scope,
}).then(function(popover) {
$scope.popover = popover;
});
$scope.openpage = function(Pagetitle, Pagecontent) {
$scope.popover.hide();
var jsonObject = {
title : Pagetitle,
content : Pagecontent
}
DataService.addcontent(jsonObject)
$state.go('app.extraPage');
}
});
この行にコメントすると
<div ng-show="showsettingButton()"> <div/>
、私のアプリは正常に動作します。
どんな助けでも大歓迎です
ありがとう。