javascript - Angular orderby with custom function + array for multiple values -
I am using a custom function with a coaler order. It looks like:
Object:
$ scope.array = [{'field1': some_value, 'field2': some_ value, ... 'field10': some_value }, ... {'field1': some_value, ... 'field10': some_value} // region may be more in future]
Controller:
<( Field), 'field 2', 'field 3', 'result', 'field 1', 'field 1', 'field4', 'field5', ..., 'field10']);But this is not beautiful & amp; The area may be more in the future. I try to string to reduce the code size.
var fieldString = ['field1', 'field2', ... 'field10']; $ Scope.array = $ filter ('orderby') ($ scope.array, [function (item)) Return custom order function (item);}, fieldString.join ()]);
But does it give an error orderby with any possible way to achieve it? Or what is the possible way to do this with javascript ?
Comments
Post a Comment