-
Notifications
You must be signed in to change notification settings - Fork 27.2k
Pipe "keyvalue" should not sort by default. #42490
Copy link
Copy link
Closed
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagebreaking changesfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
Milestone
Metadata
Metadata
Assignees
Labels
area: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagebreaking changesfeatureLabel used to distinguish feature request from other issuesLabel used to distinguish feature request from other issuesfeature: under considerationFeature request for which voting has completed and the request is now under considerationFeature request for which voting has completed and the request is now under consideration
Issue / Improvement / Feature Request
Relevant Package
@angular/common(source)Description
Currently the
keyvaluepipe sorts the keys. This result in e.g.Because it's not natual sorted. ...
Describe the solution you'd like
It should not sort by default. Respect the original object state.
It's annoying to declare a no sort method to each component which uses keyvalue. (function that returns
0for no sort.)Describe alternatives you've considered
Provide predefined sort functions. The parameter of
keyvaluecould be a string or function. The string is the name of the predefined buildin function of Angular. Like:Or we could invert the logic so that no parameter means the current behvaior but
keyvalue: 'none'disables the sort. For downwards compatibility. If you care about. But in my opinion we should ignore that. A tiny breaking change. The migration is simple: Just add'sort'to the keyvalue pipe. So I still prefer my solution: Don't sort by default.