我单击编辑图标时显示更新按钮,而使用angularjs单击视图图标时隐藏相同的更新按钮吗?

时间:2018-09-19 08:08:48

标签: angularjs

这是我的HTML代码。我有一个表单,然后编辑,查看按钮。当我单击编辑图标时,我想显示更新按钮,但是当我单击视图按钮时,我想使用AngularJS隐藏更新按钮。

<div ng-app="myapp" ng-controller="candidatecontroller">
  <div class="form-group">
    <button class="btn btn-warning" ng-click="update_data()" value="{{btnName}}">
      Update
    </button>
    <button class="btn btn-warning">
      Close
    </button>
  </div>

  <table>
    <button class="btn btn-xs btn-success" ng-click="updateData(x.id,x.candidatename, x.degree, x.percentage, x.email, x.address,x.jobtype,x.salary);">
      <i class="ace-icon fa fa-eye bigger-120"></i>
    </button>
    <button class="btn btn-xs btn-info" ng-click="updateData(x.id,x.candidatename, x.degree, x.percentage, x.email, x.address,x.jobtype,x.salary); ShowHide();">
      <i class="ace-icon fa fa-pencil bigger-120 classs"></i>
    </button>
  </table>
</div>

1 个答案:

答案 0 :(得分:1)

您要搜索的吗?

<html>

<head>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.7.2/angular.js"></script>
    <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="https://unpkg.com/ace-css/css/ace.min.css">
    <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
</head>
<div ng-app="myapp" ng-controller="candidatecontroller">
    <div class="form-group">
        <button class="btn btn-warning" ng-click="update_data()" ng-show="updatebtn">Update</button>
        <button class="btn btn-warning">Close</button>
    </div>
    <table>
        <button class="btn btn-xs btn-success" ng-click="updateData(x.id,x.candidatename, x.degree, x.percentage, x.email, x.address,x.jobtype,x.salary); updatebtn = false;">
            <i class="ace-icon fa fa-eye bigger-120"></i>
        </button>
        <button class="btn btn-xs btn-info" ng-click="updateData(x.id,x.candidatename, x.degree, x.percentage, x.email, x.address,x.jobtype,x.salary); updatebtn = true;">
            <i class="ace-icon fa fa-pencil bigger-120 classs"></i>
        </button>
    </table>
</div>
<script>
angular.module('myapp', []).controller('candidatecontroller', ['$scope', function($scope) {

}])
</script>

</html>