0

I have directive with ng-repeat, and would like to pass value to iterate through from outside.

like

<mydirective list="array" repeatstring="item in list | firstfilter | secondfilter |orderBy:value"></mydirective>
<mydirective list="array"  repeatstring="item in list | thirdfilter | secondfilter |orderBy:value"></mydirective>
<mydirective list="array"  repeatstring="item in list | fourthfilter | secondfilter |orderBy:value"></mydirective>

and the directive to look like

  <div ng-repeat="{{repeatstring}}">
<!--repeat insides -->
</div>

I've tried different variants with different binding and ng-init, but the only results it seams to show is eather expression errors or non-rendered ng-repeat. Maybe someone has pulled this trick with angular

jsFiddle: http://jsfiddle.net/Q37gC/2/

spl1n
  • 59
  • 1
  • 7

1 Answers1

0

I'm afraid you can't ! more details

So skip custom directive and use custom filter with ng-repeat like

ng-repeat="item in list | myFilter"

myApp.filter('myFilter', function () {
    return function (input) {
        // use your logic
    };
});
Community
  • 1
  • 1
Tasnim Reza
  • 6,058
  • 3
  • 25
  • 30