angular-如何隐藏一个元素并用ng-blur显示另一个元素?

时间:2016-08-11 22:05:36

标签: angularjs

我想隐藏这个div:

<div class="desc" ng-show="desc">

并显示此div

<div  class="lists"ng-show="lists" 
       ng-repeat="x in todoWork | orderBy:['todoPriority', 'todoTime']" 
       ng-class="{strike:x.done}"> 

关于ng-blur指令。

我试过了,但是,

$scope.myFunc1 = function() {  
 if($scope.myForm1.description.$dirty && $scope.myForm1.datetime.$dirty && $scope.myForm1.priority.$dirty==true){
    $scope.lists =true;
    $scope.desc=false;

 }
}; 

但只有第一个正在执行。即使尝试为第二个函数编写另一个函数,问题仍然存在。

1 个答案:

答案 0 :(得分:1)

如果您想隐藏第一个并显示第二个,那么为什么不使用如下所示的单个变量:

第一个<div ng-show="desc">

第二个<div ng-show="!desc">