I'm wrapping my head around forms and ngModel currently. So far everything works great except for the radio buttons. They are loaded and all but I can't manage to read the touched state. I guess it is because they are generated within a for loop and therefore can't be referenced
<fieldset [ngClass]="{'has-error': someReference.touched
&& someReference.invalid}">
<legend>Salutation</legend>
<div>
<label for="salutation_m">
<input id="salutation_m" name="salutation" type="radio"
[ngModel]="registration.salutation" #someReference="ngModel">
<span>Mister</span>
</label>
</div>
</fieldset>
So far it looks like the reference can't be read. I don't get any errors but even when the element is touched and invalid the class is not set.
Any hints on what I'm doing wrong?
Update
Changed #someReference to #someReference="ngModel" which solves the problem for predefined radio buttons but not for generated ones inside of a for loop.
I'm guessing in the case of a for loop there is a problem with the scope.