1

我有一个表单,我想检查它的验证,但form.$valid总是返回 true,即使表单没有编译!

<form name="compileForm" novalidate>
  <table class="mytable">
    <td ng-switch="question.type" style="width:25%" >
      <div directive-one ng-switch-when="text" >
      </div>

      <div  directive-two ng-switch-when="single" >
        <div class="radio" ng-repeat="(optionIndex, option) in my.choices">
          <input type="radio" 
                 name="optradio{{groupIndex}}_{{qIndex}}"
             id="optradio{{groupIndex}}_{{qIndex}}_{{optionIndex}}"
                 ng-model="option.select" 
                 ng-value="true" 
                 ng-change="changeValue(my.choices, optionIndex, qIndex, groupIndex)" 
                 ng-disabled="{{sdisable}}"  
                 required>
          <label class="radio-inline" 
                 for="optradio{{groupIndex}}_{{qIndex}}_{{optionIndex}}">{{option.option}}
          </label>
        </div>
      </div> 
    </td>
    <td> <span>{{compileForm.$valid}}</span></td>
  </table>  
</form>

任何帮助将不胜感激!

4

0 回答 0