-
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
Expose isIconButton publicly #11226
Expose isIconButton publicly #11226
Conversation
@DavidSouther could you talk about your use-case for needing these APIs? |
@jelbourn We have a "Progress Button" which replaces the content with an ng-spinner while awaiting an observable. It seems silly to have both @ContentChild(MatButton) as well as @ContentChild('button[mat-icon-button]') when we could just ask the button itself whether it's an icon button. And since FAB is right there, I just figured I'd expose that as well. |
src/lib/button/button.ts
Outdated
@@ -77,9 +77,15 @@ export class MatButton extends _MatButtonMixinBase | |||
|
|||
/** Whether the button is round. */ | |||
_isRoundButton: boolean = this._hasHostAttributes('mat-fab', 'mat-mini-fab'); | |||
get isRoundButton(): boolean { |
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.
Instead of making these getters, could you just make the existing properties public and readonly
? TypeScript generates a fair amount more code for getters, so it's better to avoid when you don't also need a setter.
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.
More than happy to, wanted to avoid what might be perceived as a breaking change.
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.
We consider anything prefixed with an underscore to be a private API, so it should be okay
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.
Done. PTAL. I only found the one if block, and the few .html references in this repo.
Update button.html with public property names.
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
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. |
No description provided.