1

Is there a way to get Angular to interpret strings inside an <input>'s name attribute?

We have a setup like this:

<div ng-repeat="thing in things">
    <div ng-show="form['something' + thing.name].$error.required">Field is required</div>

    <input type="text" required name="something{{thing.name}}" ng-model="thing.name">
</div>

Now, this obviously does not work because angular does not interpret name="something{{thing.name}}".

Is there some way to do this besides writing a custom directive to have a dynamic name attribute?

Jani Hartikainen
  • 42,745
  • 10
  • 68
  • 86

0 Answers0