user2028
user2028

Reputation: 183

ng-show hanging my whole application

i am getting strange problem that when ever i am trying to put ng-show inside my popover.html , my app got hangs. and when i comment it my app works fine. i am realyy not getting that whats going wrong inside my code.

here is my 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>

here is my functions in controller :-

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');
					}
                    
                  });

if i comment this line

<div ng-show="showsettingButton()"> <div/>

, my app works fine.

Any help will be greatly appreciated

Thanks.

Upvotes: 0

Views: 86

Answers (1)

sid
sid

Reputation: 1116

<div ng-if="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>

Upvotes: 1

Related Questions