search

Home  >  Q&A  >  body text

angular.js - Use AngularJS to display the menu bar on mouse click. Click on the blank space to disappear.

I want to click on the blank space to disappear. How to achieve urgent request!
Do I need to use instructions to achieve it?
<p ng-app="myApp">

<p ng-controller="ctrl">
    <ul>
        <li ng-click="animate()">点击我身上显示id为Demo的li<li>
        <li ng-show="flag">我是id为Demo的li</li>
    <ul>
</p>

</p>
<script>

angular.module("myApp",[])
    .controller('ctrl',['$scope',function($scope){
        $scope.flag = false;
        $scope.animate = function(){
            $scope.flag = !$scope.flag;
        }
    }])

</script>

阿神阿神2809 days ago560

reply all(1)I'll reply

  • 给我你的怀抱

    给我你的怀抱2017-05-15 17:03:17

    Just bind a click event on html or document or body.

    It’s up to you whether to use specific instructions or implementations

    reply
    0
  • Cancelreply