1.通过ng-click事件设置一个中间变量click,再通过ng-hide和变量click来控制div显示/隐藏
<div ng-app="" ng-init="click=false">
<button ng-click="click= !click">隐藏/显示</button>
<div ng-hide="click">
请输入一个名字:<input type="text" ng-model="name" />
Hello <span ng-bind="name"></span>
</div>
时间: 2024-10-05 17:39:42