javascript - Why is my tag still showing? -
this what's inside controller what's wrong way pass values? tried putting inside function still didn't fixed it. removed parts of code since i'm pointing out on how show or hide div using angularjs ng-show
. followed answer in link
var atag = this; atag.vaanchor = false; atag.nseanchor = false; //showanchor(); // function showanchor(){ var encodedstring = 'action=' + encodeuricomponent("checklogin") + '&user=' + encodeuricomponent(dataform.datausername) + '&pw=' + encodeuricomponent(dataform.datapassword); $scope.errormsg = ""; //reset error message .success(function(data, status, headers, config) { if ( data[0]["data"] != undefined) { $scope.errormsg = "incorrect username/password"; $("#mypass").focus(); } else if ( data[0]["data"] === undefined) { apprsal.setusertype(data[0]["type"]); if(apprsal.userselecteddata().usertype === "") { atag.vaanchor = true; } else { atag.nseanchor=true; } $ionichistory.nextviewoptions({ disableback: true }); $state.go('app.main'); } }) .error(function(data, status, headers, config) { $scope.errormsg = 'unable submit form' + status; $ionicloading.hide(); }) } //}
and whats inside html:
<li> <a href="#/app/va-contact" ng-show="atag.vaanchor"> <i class="icon ion-ios-people"></i> <span>contacts</span> </a> </li> <!-- nse --> <li> <a href="#" id="lnkcorp" ng-show="atag.nseanchor"> <i class="icon ion-ios-people"></i> <span>contacts</span> </a> </li> <li> <a href="#" id="lnknetwork" ng-show="atag.nseanchor"> <i class="icon ion-ios-calendar-outline"></i> <span>planner</span> </a> </li> <li> <a href="#" id="lnknetworkva" ng-show="atag.vaanchor"> <i class="icon ion-ios-calendar-outline"></i> <span>planner</span> </a> </li>
please change ng-show="atag.nseanchor"
ng-show="nseanchor"
if understand correctly, atag $scope. no need inside html.
Comments
Post a Comment