0
Angular (1.x) 형식을 만들고 ng-model 및 JSON을 사용하여 라디오 및 확인란을 미리 채 웁니다. 어떤 이유로 수동으로 라디오 또는 체크 박스 요소를 다시 검사 할 때까지 미리 채워진 값이 양식 범위에 표시되지 않습니다. 미리 채워진 입력을 수집하기 위해 양식 데이터를 얻으려면 어떻게합니까?ng-submit에서 사전 정의 된 입력 캡처
<tr ng-repeat="option in item.reportOptions" >
<td style="width: 100%;">
<h5><strong>{{option.title}}</strong></h5>
<!-- Check All -->
<div class="form-group" ng-if="option.type=='checkbox'">
<label for="{{option.name}}" class="checkbox-inline">(check all) <strong>{{option.label}}</strong>
<input type="checkbox" name="{{option.name}}" ng-model="checkAll" ng-value="{{option.value}}" ng-checked="option.checked==true" ng-click="selectAll()">
</label>
</div>
<!-- Person -->
<div class="form-group" ng-if="option.type=='select' && option.name=='person'">
<select ng-model="cerOptions.primary">
<option ng-init="cerOptions.primary=user[0]" ng-repeat="user in selectionData" ng-value="{{user.NewID}}">{{user.NewID}}--{{user.lastName}},{{user.firstName}}</option>
</select>
</div>
<!-- Mask Names -->
<div class="form-group" ng-if="option.type=='select' && option.name=='maskNames'">
<select name="{{option.name}}" ng-model="maskNames">
<option ng-selected="maskNames == option.value" ng-repeat="opt in option.options" ng-value="opt.value">{{opt.label}}</option>
</select>
<div ng-if="maskNames=='yes'">
<p class="help-text">Check the user you would like to mask, then enter name.</p>
<div class="form-group" ng-repeat="user in selectionData">
<div class="col-sm-2">
<label class="checkbox-inline">{{user.NewID}}--{{user.lastName}},{{user.firstName}}
<input type="checkbox" ng-model="toggleText">
</label>
</div>
<div class="col-sm-2">
<input type="text" ng-if="toggleText" ng-model="cerOptions.maskName[user.NewID]" value="Person{{$index}}">
</div>
</div>
</div>
</div>
<!-- Name Tags -->
<div class="form-group" ng-if="option.type=='nameTag'">
<table class="table table-striped table-condensed" style="width: 50%;">
<thead>
<tr>
<th>New ID</th>
<th>Last Name</th>
<th>First Name or Nickname</th>
<th>Company</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="user in selectionData">
<td>{{user.NewID}}</td>
<td><input type="text" ng-model="cerOptions.nameTagsLast[user.NewID]" ng-init="cerOptions.nameTagsLast[user.NewID]=[user.lastName]" value="{{user.lastName}}"></td>
<td><input type="text" ng-model="cerOptions.nameTagsFirst[user.NewID]" ng-init="cerOptions.nameTagsFirst[user.NewID]=[user.firstName]" value="{{user.firstName}}"></td>
<td><input type="text" ng-model="cerOptions.nameTagsComp[user.NewID]" ng-init="cerOptions.nameTagsComp[user.NewID]=[user.accountName]" value="{{user.accountName}}"></td>
</tr>
</tbody>
</table>
</div>
<!-- Nested Checkboxes and Radios -->
<div class="form-group" ng-if="option.options.length > 0">
<label ng-repeat="deet in option.options" ng-if="deet.type=='radio'" for="{{deet.name}}" class="radio-inline">{{deet.label}}
<input type="radio" name="{{deet.name}}" ng-model="cerOptions.options[deet.name]" ng-value="{{deet.value}}">
</label>
<label ng-repeat="deet in option.options" ng-if="deet.type=='checkbox'" for="{{deet.name}}" class="checkbox-inline">{{deet.label}}
<input type="checkbox" name="{{deet.name}}" ng-model="cerOptions.options[deet.name]" ng-value="{{deet.value}}" ng-checked="{{deet.checked}}">
</label>
</div>
코드를 게시 할 수 있습니까? –
코드를 추가했습니다. –
흠, 내가 완성하지 못한 버그 기능입니다. 이유가 될 수 있을까요? 해결책은 $ watch 지시문을 사용하는 것과 관련이 있다고 생각하기 때문에 게시했습니다. 정상적인 기본 동작을 얻으려고하는 동작입니까? 그렇다면 기존 코드를 문제없이 처리 할 수있는 방향을 제시합니다. –