I have something like this:
<li ng-repeat="item in items">
{{item.name}}
</li>
The item
object has a property called index
. How do I assign it to the tabIndex
so my output looks like:
<li tabIndex="100">Mike</li>
<li tabIndex="101">Smith</li>
I've tried this but it cannot access the current item:
<li ng-repeat="item in items" tabIndex="item.index">
{{item.name}}
</li>
<li ng-repeat="item in items" tabIndex="{{item.index}}">
{{item.name}}
</li>
Note: If tabIndex
happens to be a directive in your app with isolate scope, and you are using the @attr
to get the value, the interpolation (braces) is needed. An alternative would be to leave them out and define the variable in your directive like =attr
instead.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With