0
Checklist-modelを使用して、チェックボックスでデータを表示しています。データは、約束の結果として提供される。リストには値が設定されていますが、すべてのチェックボックスをデフォルトとしてチェックします。どうすればこれを達成できますか? $scope.versionForm.ignoreRule
プリントコンソールにChecklist-modelですべてのチェックボックスをデフォルトとしてチェックします。
datas.getRules().then(
function (resRules)
{
$scope.rules = resRules.data._embedded.rules;
$scope.versionForm.ignoreRule = $scope.rules.map(r => r.id);
console.log($scope.versionForm.ignoreRule);
},
function (resRulesErr)
{
console.log(resRulesErr);
}
);
<table class="table">
<thead>
<tr>
<th>Include</th>
<th>Rule</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="r in rules track by $index">
<td><input type="checkbox" checklist-model="versionForm.ignoreRule" checklist-value="r.id" />
</td>
<td>{{r.expression}}</td>
</tr>
</tbody>
</table>
は、それが[64、67、18]を示す:
はここに私のコードです。あなたのコードで
'checklist-model'ディレクティブはどこから来ますか?角度のあるコアにはそのような指示はありません – charlietfl
https://github.com/vitalets/checklist-model –