As several items sort by other keys in the ng-repeat -> orderBy?

Link to JSFiddle.

For example, there is an array of polzovateley, firstName and lastName.
When rendered in the frontend using ng-repeat to sort them by the key firstName. But some of them need to sort through lastName.

The result of this.
$scope.users = [{
 firstName: 'AAA',
 lastName: 'AAA'
 }, {
 firstName: 'BBB_test',
 lastName: 'EEE'
 }, {
 firstName: 'CCC',
 lastName: 'CCC'
 }, {
 firstName: 'DDD_test',
 lastName: 'WWW'
}];

// output
AAA
BBB_test
CCC
DDD_test


Name BBB_test and DDD_test during sorting vzat do not need firstName and lastName.
// Expect Result
AAA
CCC
BBB_test
DDD_test

How is this implemented ?
March 20th 20 at 11:27
1 answer
March 20th 20 at 11:29
Solution

Find more questions by tags JavaScriptAngular