隐藏2个div并通过ng-hide / ng-show / ng-click显示1个div

时间:2019-05-01 07:51:13

标签: javascript jquery angularjs

我正在使用angularjs,在我的代码中,它已经可以隐藏和显示bankregel和文档。我用相同的ng-show和hide函数添加了一个新的div,但是没有显示出来。它保持隐藏状态。当我单击按钮时,它不会更改为块元素。

元素1

<div class="container main-wrapper" ng-init="bankregel=false;">
<div ng-hide="bankregel">
    <table class="table">
        <thead>
        <tr>
            <th>Omschrijving</th>
            <th>Bedrag</th>
            <th>Datum</th>
        </tr>
        </thead>
        <tbody>
        <tr ng-click="selectBankRegel(bankline)" style="cursor: pointer;" ng-repeat="bankline in filteredItems">
            <td style="width:140px; max-width: 140px; text-overflow: ellipsis; white-space: nowrap; overflow: hidden;">{{bankline.oms}}</td>
            <td>{{bankline.bedrag}}</td>
            <td>{{bankline.datum}}</td>
        </tr>
        </tbody>
    </table>
</div>

函数selectBankregel

    $scope.selectBankRegel = function(bankline){
    $scope.bankregel = true;
    $scope.selectedBankline = bankline;
    // $scope.$apply();
}

元素2

<div class="container main-wrapper" ng-init="document=false;">
<div ng-show="bankregel">
    <div class="row bankregel-wrapper">
        <div class="col-12" style="margin-top: 10px; margin-bottom: 10px;">
            <button style="margin-bottom: 25px" ng-click="bankregel=false " ng-show="deviceType == 'iphone' || deviceType == 'ipod' || deviceType == 'ipad' || deviceType == 'webos'" class="btn-fleximaal-dark">Terug naar bankregels</button>
            <button ng-click="document=false"class="btn-fleximaal-dark">Bankregel koppelen</button>
        </div>
    </div>
</div>

元素3

<div class="container main-wrapper" ng-init="scan=false;">
<div ng-show="document">
   <h1>test</h1>
</div>

当我点击

时,我正在尝试创建
<button ng-click="document=false"class="btn-fleximaal-dark">Bankregel koppelen</button>

隐藏bankregel元素和document元素,以便可以显示scan元素。

0 个答案:

没有答案