Home > Article > Web Front-end > ng-show in angularjs not working? _html/css_WEB-ITnose
Paste the code first
<html ng-app> <body> <div ng-controller="DeathrayMenuController"> <button ng-click='toggleMenu()'>isShow</button> <ul ng-show="menuState.show"> <li >zero</li> <li >one</li> <li >two</li> </ul> </div> <script src="angular.js"></script> <script> function DeathrayMenuController($scope){ $scope.menuState.show=false; $scope.toggleMenu=function(){ $scope.menuState.show=!$scope.menuState.show; } }; </script> </body></html>
Debug it and look at the actual html. It is estimated that other tags are nested, so show and hide may not be valid! !
Debug it and see the actual html. It is estimated that other tags are nested, so show and hide may not be valid! !