Here is the code that I am working with:
<div class="form-group" ng-repeat="(key, day) in {'monday':'Monday','tuesday':'Tuesday','wednesday':'Wednesday','thursday':'Thursday','friday':'Friday','saturday':'Saturday','sunday':'Sunday'}">
<label for="{{key}}" class="col-sm-3 control-label">{{day | translate}}</label>
<div class="col-sm-4">
<input type="number" class="form-control" ng-model="wd.{{key}}" id="{{key}}" name="{{key}}" min="1" placeholder="{{'Enter the price' | translate}}" required />
</div>
</div>
In this code snippet, there is an ng-model
on the input
attempting to dynamically set the model as wd.{{key}}
.
However, upon running the code, an error message states that there is an invalid property name after the dot.
Is there a way to achieve the same functionality without duplicating HTML for each day of the week?