angular.js - 用AngularJS做菜单栏鼠标点击显示。点击空白处消失。
阿神
阿神 2017-05-15 17:01:17
0
1
503

我想要点击空白处消失。如何实现急求!
需要用指令实现吗?
<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>

阿神
阿神

闭关修行中......

reply all(1)
给我你的怀抱

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

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!