-
Notifications
You must be signed in to change notification settings - Fork 27.4k
fix(select): Add exception for unsupported ngOptions use case #9290
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -338,6 +338,12 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) { | |
// - optionGroupsCache[?][0] is the parent: either the SELECT or OPTGROUP element | ||
optionGroupsCache = [[{element: selectElement, label:''}]]; | ||
|
||
if (track && match[2] && valueName !== match[1]) { | ||
throw ngOptionsMinErr('trackSelect', | ||
"Do not use 'track by' when your select ('{0}') is different from your value ('{1}')", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as an english speaker, I have no idea what this error message is telling me. "Do not use 'track by' when your select (what is "my select"?) is different from your value (??? what!?)" There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Those are the terms used in the documentation to describe the different parts of the ng-options expression (see https://docs.angularjs.org/api/ng/directive/select). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would rather we didn't have this limitation in the first place and just made this work the way people expect it to work. |
||
match[1], valueName); | ||
} | ||
|
||
if (nullOption) { | ||
// compile the element since there might be bindings in it | ||
$compile(nullOption)(scope); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is no minerr file being added in this PR, that I can see. Do we already have a trackSelect error used for something else?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It doesn't look like we do, please add an error file to https://github.com/angular/angular.js/tree/master/docs/content/error/ngOptions