在“提交”之后我试图隐藏我的表单.我想用ng-if来做.单击“查看”按钮可以打开和关闭表单,但它不适用于“添加”按钮.这是什么原因?
我创建了一个JSFiddle. Link to JSFiddle.
我的表格:
<form name="userAddForm" ng-submit="something()" class="form-horizontal" role="form"> <div class="form-group"> <label class="col-md-2 control-label">Username</label> <div class="col-md-3"> <input name="username" ng-model="user.username" class="form-control" ng-required="true" placeholder="Username" type="text" /> </div> </div> <div class="form-group"> <label class="col-md-2 control-label">Password</label> <div class="col-md-3"> <input name="password" ng-model="user.password" class="form-control" placeholder="Password" type="password" ng-required="true" /> </div> </div> <button ng-disabled="userAddForm.$invalid" type="submit" ng-click="add=!add" class="btn btn-success"> <span class="glyphicon glyphicon-ok"></span> Add </button> </form> </div>