As far as I know, a directive doesn't have an index in a view like this. However what you could do is something like:
<div directive index="0"></div>
<div directive index="1"></div>
<div directive index="2"></div>
And then in the javascript:
app.controller('AppController', [ '$scope', function ($scope) {
$scope.offsetTopValues = [];
}]);
app.directive('directive', function ($window) {
return function($scope, element, attrs) {
$scope.offsetTopValues[attrs.index] = element[0].offsetTop;
};
});