AngularJS 中 ng-if 能不能进行多条件判断
3 回答

喵喵时光机
TA贡献1846条经验 获得超7个赞
当然可以,按题主的描述,比如这样:
controller中:
$scope.checkMyVal = function(){
return $scope.myVal == 1;
}
view:
<input type="text" ng-model="myVal">
<div ng-if="checkMyVal()">
myVal:${myVal}
</div>

PIPIONE
TA贡献1829条经验 获得超9个赞
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | <!DOCTYPE html> <html ng-app> <head> <title>checked</title> </head> <body>
<input type="checkbox" ng-model="checked">点击试试
<div ng-if="checked">content</div>
<script type="text/javascript" src="./angular.min.js"></script>
</body> </html> |
- 3 回答
- 0 关注
- 1729 浏览
添加回答
举报
0/150
提交
取消