javascript - how to combine ng-if , ng-click and ng-show and use them together -
pre-info
i try sperate admin , customer in different stage or view.
so that, admin can modify table before releasing customers.
questions in table -> td there button control staging, release(show) or revert (hide)?
so wanna every table checked can shown on both in admin , customer. if it's unchecked, data show admin.
currently, code disabled whole table-body instead of 1 row.
is there way check or uncheck 1 row?
thanks advice.
$scope.showdiv = isadmin(); $scope.toggleshowdiv = function () { $scope.showdiv = !isadmin()&isadmin(); console.log('fired'); };
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script> <thead> <tr> <th style="width: 80px">foo1</th> <th style="width: 80px">foo2</th> <th style="width: 200px">foo3</th> <th>foo4</th> <th>foo5</th> <th>foo6</th> </tr> </thead> <tbody class="auction-group" ng-repeat="a in foos" ng-if="showdiv"> <tr> <td>abcd1</td> <td>abcd1</td> <td>abcd1</td> <td>abcd3</td> <td>abcd4</td> <td>abcd5</td> //is admin - show admin <td ng-if="::isadmin()"> <input type="checkbox" ng-click="toggleshowdiv()" /> </td> </tr> </tbody>
take first ng-if outside ng-repeat
<div ng-if="showdiv"> <tbody class="auction-group" ng-repeat="a in foos"> </div>
second ng-if should this,
<td ng-if="isadmin()"> <input type="checkbox" ng-click="toggleshowdiv()" /> </td>
Comments
Post a Comment