Skip to content

Commit d75aae8

Browse files
committed
fix equal condition
1 parent 8b259a6 commit d75aae8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/lib/table/table-data-source.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,14 @@ export class MatTableDataSource<T> implements DataSource<T> {
123123

124124
let comparatorResult = 0;
125125
if (valueA && valueB) {
126-
comparatorResult = valueA < valueB ? -1 : 1;
126+
// Check if one value is greater than the other; if equal, comparatorResult should remain 0.
127+
if (valueA > valueB) {
128+
comparatorResult = 1;
129+
} else if (valueA < valueB) {
130+
comparatorResult = -1;
131+
}
127132
} else if (valueA) {
128-
comparatorResult = 1;
133+
comparatorResult = 1;
129134
} else if (valueB) {
130135
comparatorResult = -1;
131136
}

0 commit comments

Comments
 (0)