angularjs - get previous scope in ng-repeat -


is there better way 1 previous scope ng-repeat inside directive?

view

<div ng-repeat="item in items track $index">          <div my-directive> item {{ $index }} </div>     </div> 

directive

.directive('mydirective', function(){   return {      restrict : 'a',     link : function(scope){         //get scope of previous item        var previousscopetext = scope.$parent.items[scope.$index - 1].val();      }    };  }); 

the purpose faster , not pass trough parent.

any ideas?


Comments

Popular posts from this blog

javascript - Karma not able to start PhantomJS on Windows - Error: spawn UNKNOWN -

c# - Display ASPX Popup control in RowDeleteing Event (ASPX Gridview) -

Nuget pack csproj using nuspec -