AngularJS 中 ng-if 能不能進行多條件判斷
3 回答

喵喵時光機
TA貢獻1846條經(jīng)驗 獲得超7個贊
當(dāng)然可以,按題主的描述,比如這樣:
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條經(jīng)驗 獲得超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 關(guān)注
- 1749 瀏覽
添加回答
舉報
0/150
提交
取消