如何显示和隐藏DIV的角 [英] How to show and hide DIV in angular
本文介绍了如何显示和隐藏DIV的角的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有两个格(S)
<div id = 'a'>
</div>
<div id = 'b'>
</div>
点击添加按钮,我想隐藏一个DIV并显示DIV b
click on "add" button i want to hide div a and show div b
推荐答案
您会适应你的HTML标记是这样的:
You would adapt your html markup like this:
<div ng-controller="controller">
<div id = 'a' ng-show="showA">
</div>
<div id = 'b' ng-show="showB">
</div>
<button ng-click="add()">Add</button>
</div>
然后,在你的控制器,有这样的事情:
And then, in your controller, have something like this:
function controller($scope) {
$scope.showA = true;
$scope.showB = false;
$scope.add = function() {
$scope.showA = false;
$scope.showB = true;
};
}
这篇关于如何显示和隐藏DIV的角的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文