我使用的角度,並有一個這樣的無線電輸入(在表格的,如果它事項):如何取消選擇所有無線電輸入?
<input type="radio"
name="inputName"
id="someId"
data-ng-value=true <!-- This select "true" for my ng-model when clicked-->
ng-model = "nameOfMyVarIn$scope"
ng-change = "thisRunsWhenSelectionIsmade(true)"
required></input>
我要清除此輸入。清除綁定到ng-model的變量會清除變量,但不會清除複選框。我無法找到如何清除單選按鈕本身in the docs或random articles - 它保持選中狀態。我從文檔中快速複製了示例,並添加了$scope.clearSelection
- 目標是使此功能取消選擇所選輸入。在實際應用程序中,我在表單中有其他輸入,所以我不能只清除整個表單。
呼叫'.reset段()'表單元素上。 –
謝謝,基本上$ scope.nameOfForm.nameOfField.reset()? nameOfForm是表單的名稱屬性的值。 – VSO