I simplify my problem as following: I want to make a myDirective directive so that:
Developer input:
<my-directive>
<label ng-repeat="opt in [1,2]">
<input type="radio" name="radio" id="opt" value="opt" ng-model="radioModel.name"> Radio {{opt}}
</label>
</my-directive>
Expected html output:
<my-directive>
<label class="myClass">
<input type="radio" name="radio" id="opt" value="opt" ng-model="radioModel.name"> Radio {{opt}}
</label>
<label class="myClass">
<input type="radio" name="radio" id="opt" value="opt" ng-model="radioModel.name"> Radio {{opt}}
</label >
</my-directive>
My question is how could I dynamically add class "myClass" to each label tag? Here is my jsfiddle. As you see, currently I'm able to do so because I manually added each label tag one by one, but I want to use ng-repeat instead. Any ideas/inputs are appreciated.
<label class="myClass" ng-repeat="i in [1,2]">{{i}}</label>