Skip to content
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

Merged
merged 1 commit into from
May 2, 2017

Conversation

crisbeto
Copy link
Member

@crisbeto crisbeto commented Apr 22, 2017

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 #4169.

@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Apr 22, 2017
@willshowell
Copy link
Contributor

Fixes #4169

@jelbourn jelbourn requested a review from kara April 24, 2017 16:23
constructor(@Attribute('xPosition') posX: MenuPositionX,
@Attribute('yPosition') posY: MenuPositionY,
@Attribute('x-position') deprecatedPosX: MenuPositionX,
constructor(@Attribute('x-position') deprecatedPosX: MenuPositionX,
Copy link
Contributor

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?

@@ -81,6 +100,12 @@ export class MdMenu implements AfterContentInit, MdMenuPanel, OnDestroy {
}
}

ngOnChanges(changes: SimpleChanges) {
if (changes['xPosition'] || changes['yPosition']) {
this.setPositionClasses();
Copy link
Contributor

@kara kara Apr 26, 2017

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?

Copy link
Member Author

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.

Copy link
Contributor

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.

@kara kara assigned crisbeto and unassigned kara Apr 26, 2017
@crisbeto crisbeto force-pushed the 4169/menu-position-binding branch 2 times, most recently from 582c2a3 to e14d91d Compare April 27, 2017 17:01
@crisbeto crisbeto assigned kara and unassigned crisbeto Apr 27, 2017
@crisbeto
Copy link
Member Author

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.
@willshowell
Copy link
Contributor

Also fixes #1329

Copy link
Contributor

@kara kara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kara kara added pr: lgtm action: merge The PR is ready for merge by the caretaker and removed pr: needs review labels Apr 28, 2017
@kara kara removed their assignment Apr 28, 2017
@mmalerba mmalerba added the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label Apr 28, 2017
@mmalerba
Copy link
Contributor

There are some teams in google that extend MdMenuPanel, we will need to update them before merging

@andrewseguin andrewseguin removed the presubmit failures This PR has failures in Google's internal presubmit process and cannot be immediately merged label May 2, 2017
@andrewseguin andrewseguin merged commit 1fd50aa into angular:master May 2, 2017
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Can't bind to 'xPosition' since it isn't a known property of 'md-menu'.
6 participants