Hey guys,
sorry, if this an obvious one, cant seem to find an answer right now.
In an attribute of a directive I'd like to use an expression which should return the array index of a certain object.
Say, in my scope I have:
$scope.items = ['foo', 'bar', 'spam'];
$scope.selectedItem = 'spam';
Now in HTML I'd like to do sth like:
<myDir selectedIndex="items | indexOf: selectedItem"></myDir>
Does a filter like this exist already or do I write my own? Am I again doing everything totally wrong altogether? : )
Thank you!
Carsten