Angularjs 从元素属性获取ng repeat指令中的orderBy值?

Angularjs 从元素属性获取ng repeat指令中的orderBy值?,angularjs,Angularjs,所以我有这个指令: app.directive('replaceelement', function() { return { restrict: 'E', replace: true, scope:true, link: function(scope, element, attrs) { scope.blockcss = attrs.blockcss; scope.sorte

所以我有这个指令:

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 something | limitTo:10 | orderByPriority | orderBy:sorter"  ng-include src="blockcss+\'.html\'"></div>'

    }
});
app.directive('replaceelement',function(){
返回{
限制:'E',
替换:正确,
范围:正确,
链接:函数(范围、元素、属性){
scope.blockcss=attrs.blockcss;
scope.sorter=attrs.sorter;
},
模板:“”
}
});
没什么特别的

这是它应该运行的元素

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

我运行一个简单的ng单击来更改控制器中名为sorter的变量

Orderby不适用于sorter属性。我有一种感觉,这是因为sorter是控制器中的一个变量,我不能通过属性传递的名称来调用它

我整天都在做这件事,找不到办法。有人能帮忙吗


感谢

ng repeat中的orderBy仅适用于阵列。请参见此处

您能提供一个plunker吗?这会有很大帮助。有没有办法在link:函数中将字符串转换成数组?