I have a drop down list in the repeater that should toggle my custom “required” attribute. I tried ng-show, but the display = "none" attribute is all that has been added. My parameters: -
1 - Add / remove the input field and set bird.Stuff, and not just hide it, because it is still required.
2 - Add / remove the attribute 'required' in the input field.
Js
$scope.validateParticipants = function (type) {
if (type == "Single") {
this.donation.Participants = "1";
}
else
this.donation.Participants = "";
}
HTML
<div ng-repeat="bird in animalTest.birds">
@(Html.DropDownList("Type", (IEnumerable<SelectListItem>)ViewBag.BirdList, new { ng_model = "bird.Type", ng_change = "validateRequired(bird.Type)", required = "Type is required" }))
...
<input data-ng-show="bird.Type == 'Endangered'" id="stuff" type="number" data-ng-model="bird.Stuff" required = "Number of Volunteers required"/>
</div>
Thanks for the help in advance!
source
share