After calling console.log($scope.showAddEvent)
, it is evident that the variable showAddEvent
is being updated. However, the ng-if directive does not seem to reflect these changes as it does not display anything at all.
As I am relatively new to angularjs, I may be missing something...
html
<ion-footer-bar align-title="center" class="bar-positive" ng-if="$scope.showAddEvent == true">
<div class="title" ng-click="modal.show()">Add Event</div>
</ion-footer-bar>
controller.js
$scope.showAddEvent;
var currentUser = Backand.getUserDetails().$$state.value;
if (currentUser.role == "Admin" || currentUser.role == "Verified"){
$scope.showAddEvent = true;
console.log(currentUser.role);
console.log('you can add event');
console.log($scope.showAddEvent);
}
else {
$scope.showAddEvent = false;
console.log(currentUser.role);
console.log('You cannot add Event');
console.log($scope.showAddEvent);
}