-
Notifications
You must be signed in to change notification settings - Fork 6.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(menu): unable to bind to xPosition and yPosition #4213
fix(menu): unable to bind to xPosition and yPosition #4213
Conversation
Fixes #4169 |
src/lib/menu/menu-directive.ts
Outdated
constructor(@Attribute('xPosition') posX: MenuPositionX, | ||
@Attribute('yPosition') posY: MenuPositionY, | ||
@Attribute('x-position') deprecatedPosX: MenuPositionX, | ||
constructor(@Attribute('x-position') deprecatedPosX: MenuPositionX, |
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.
While we're in here, let's remove the deprecated positions?
src/lib/menu/menu-directive.ts
Outdated
@@ -81,6 +100,12 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy { | |||
} | |||
} | |||
|
|||
ngOnChanges(changes: SimpleChanges) { | |||
if (changes['xPosition'] || changes['yPosition']) { | |||
this.setPositionClasses(); |
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.
Curious why we are adding a hook to call setPositionClasses
when we already have the setters above. I think it might be cleaner not to break up the logic?
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 I understood the question. The setters aren't dealing with the classes at all.
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.
The classes need to be updated whenever the xPosition or the yPosition changes. For that reason, it makes more sense to me to call this method in the xPosition and yPosition setters rather than creating a hook just to listen for changes on those properties.
582c2a3
to
e14d91d
Compare
Addressed the feedback @kara. |
Fixes not being able to use data bindings on the `xPosition` and `yPosition` properties. **Note:** These changes could be considered breaking, if somebody was implementing the `MdMenuPanel` interface. Fixes angular#4169.
e14d91d
to
b6af4d0
Compare
Also fixes #1329 |
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
There are some teams in google that extend MdMenuPanel, we will need to update them before merging |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Fixes not being able to use data bindings on the
xPosition
andyPosition
properties.Note: These changes could be considered breaking, if somebody was implementing the
MdMenuPanel
interface.Fixes #4169.