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
Post a Comment