angularjs - Get orderBy value in ng-repeat directive from element attribute? -


so have directive:

app.directive('replaceelement', function() {     return {         restrict: 'e',         replace: true,         scope:true,         link: function(scope, element, attrs) {             scope.blockcss = attrs.blockcss;             scope.sorter = attrs.sorter;          },       template:'<div class="{{blockcss}}" ng-repeat="content in | limitto:10 | orderbypriority | orderby:sorter"  ng-include src="blockcss+\'.html\'"></div>'      } }); 

nothing special.

this element should run on.

<replaceelement blockcss="cssname" sorter="sortby"></replaceelement> 

i run simple ng-click change variable called sorter in controller.

orderby not work sorter attribute. have feeling because sorter variable in controller, , cant call name passed attribute?

been working on day , cant find way it. can please?

thanks

the orderby in ng-repeat works exclusively arrays. see here https://docs.angularjs.org/api/ng/filter/orderby


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -