-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(select): when using trackBy, trigger ng-change only when tracked property is different #11156
Conversation
29ba62b
to
239ee8e
Compare
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.
Thank you for sending this PR!
I just had the one minor typo comment. Manual testing looks good.
One other thing, can you please update the commit to more closely follow the commit guidelines especially with the Closes
line being on the last line? Thank you.
239ee8e
to
a85b500
Compare
@Splaktar Do you have any clue on why is the travis ci build failing? It seems to be failing on other pull requests as well. |
TravisCI had a significant outage last night around that time. I've restarted the tests. |
I need to improve the commit message guidelines, sorry for the confusion. I'll try to add some examples to them. I believe that the footer needs to use the format |
a85b500
to
74413ee
Compare
I've changed the commit message. But the travis ci build seems to be still failing. |
It also looks like there is an issue with the AngularJS snapshot builds. I'll check with the team. |
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.
LGTM
It's possible that their snapshot somehow got corrupted by the TravisCI outage. I'll let you know when I find out more. |
74413ee
to
41a67b2
Compare
Which would be the best way to integrate this fix into my project before the next version of angular material is released? |
41a67b2
to
7a7bc3d
Compare
Once we get it merged, there will be a build with a hash on it that you will be able to install directly via NPM. |
src/components/select/select.js
Outdated
// if they have the same length, then they are different | ||
// if an item in the newVal array can't be found in the prevVal | ||
return newVal.every(function(newValItem) { | ||
return !!prevVal.find(function(prevValItem) { |
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.
Not sure what the supported browsers are, but make sure they all implement .find()
(IE does not for example).
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.
Gosh! I've always thought find
was supported since IE 9...
7a7bc3d
to
c61d361
Compare
It looks as though the internal issues have been resolved and this may be able to get into |
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.
LGTM
PR Checklist
Please check that your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
When using
ng-model-options="{ 'trackBy': '$value.someProperty' }"
on md-select,ng-change
is triggered when the selected option's object is not equal to the one of the model (the comparison is done withangular.equals
which compares recursively all the properties of the object).Issue Number: #11108
What is the new behavior?
ng-change
is triggered when the tracked property of the model is different from the selected option.Does this PR introduce a breaking change?
Other information