1
我需要隱藏行取決於複選框,使用ng-click中的myfunction訪問動態值。隱藏列動態取決於複選框的角度
var app = angular.module("myApp", []);
app.controller("myCtrl", function($scope) {
$scope.firstName = "John";
$scope.lastName = "Doe";
\t $scope.jsonmain = ["brand","checkstatus","color","fabric","fit","package contents","size","sku","style","title","type","wash care"];
\t $scope.myfunction = function (skip) {
\t \t $scope.skip = !$scope.skip;
};
});
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script>
<div ng-app="myApp" ng-controller="myCtrl">
<span ng-repeat = "skip in jsonmain">
\t <input type="checkbox" ng-click="myfunction(skip)" type="button" class="btn btn-success">{{skip}}</input>
</span>
\t <table style="border: 1px solid ;">
\t \t <tr>
\t \t \t <td style="border: 1px solid #dddddd;" ng-hide="{{display}}" ng-repeat= "display in jsonmain">
\t \t \t \t {{display}}
\t \t \t </td>
\t \t </tr>
\t </table>
</div>
感謝萊克斯工作完美.. – user6701603