Angular, setting dynamic tabindex using a custom directive

This confuses. I canโ€™t figure out how to do something pretty trivial.

tr.row(ng-repeat="user in users") td div(input-inline-edit="user.name" tabindex="{{ $index*10 + 1 }}") td div(input-inline-edit="user.surname" tabindex="{{ $index*10 + 2 }}") td div(tabindex="{{ $index*10 + 3 }}") 

Since I have lines, I need to be able to cross tabindex line by line. So, I thought it was best to have the first line 1,2,3,4 the following 11,12,13,14 then 21,22,23,24

and etc.

I am so confused that I could not do this, the above code does not work, I tried

 {{$index *10 + 1}} 

or {{getIndex($index, 1)}}") with the controller:

 $scope.getIndex = function(index,i) { return index*10 + i; } 

and countless other combinations ... I canโ€™t believe that I didnโ€™t achieve something like simple

EDIT: OK, it turns out I was greedy with information. I have my own directive for inline editing, "input-inline-edit". I edited the code accordingly above. Therefore, if I have this directive, tabindex DOES NOT work, but if I have a normal div (the third in the example above), it DOESN'T GIVE !!! Therefore, for the first two I get tabindex = null, for the third I get a real number. I am puzzled.

+8
angularjs ng-repeat
source share
1 answer

IT'S EASY. No need to complicate it too much. Just specify each of the repeating SAME tabindex elements. Users will still be able to view them as before.

+10
source share

All Articles