Skip to content

docs(material/button-toggle): add missing type on public API #22224

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

Merged
merged 1 commit into from
Mar 15, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/material/button-toggle/button-toggle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ export const MAT_BUTTON_TOGGLE_GROUP_VALUE_ACCESSOR: any = {
multi: true
};

let _uniqueIdCounter = 0;
// Counter used to generate unique IDs.
let uniqueIdCounter = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for clarification, could you fill me in on why we are making this public? Or is there another reason we're removing the underscore?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't make it public, I just removed the underscore since the constant isn't being exported so the name doesn't really matter.


/** Change event object emitted by MatButtonToggle. */
export class MatButtonToggleChange {
Expand Down Expand Up @@ -157,7 +158,7 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After
});
}
}
private _name = `mat-button-toggle-group-${_uniqueIdCounter++}`;
private _name = `mat-button-toggle-group-${uniqueIdCounter++}`;

/** Whether the toggle group is vertical. */
@Input()
Expand Down Expand Up @@ -190,7 +191,7 @@ export class MatButtonToggleGroup implements ControlValueAccessor, OnInit, After
@Output() readonly valueChange = new EventEmitter<any>();

/** Selected button toggles in the group. */
get selected() {
get selected(): MatButtonToggle | MatButtonToggle[] {
const selected = this._selectionModel ? this._selectionModel.selected : [];
return this.multiple ? selected : (selected[0] || null);
}
Expand Down Expand Up @@ -424,6 +425,7 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
*/
@Input('aria-labelledby') ariaLabelledby: string | null = null;

/** Underlying native `button` element. */
@ViewChild('button') _buttonElement: ElementRef<HTMLButtonElement>;

/** The parent button toggle group (exclusive selection). Optional. */
Expand Down Expand Up @@ -504,7 +506,7 @@ export class MatButtonToggle extends _MatButtonToggleMixinBase implements OnInit
ngOnInit() {
const group = this.buttonToggleGroup;
this._isSingleSelector = group && !group.multiple;
this.id = this.id || `mat-button-toggle-${_uniqueIdCounter++}`;
this.id = this.id || `mat-button-toggle-${uniqueIdCounter++}`;

if (this._isSingleSelector) {
this.name = group.name;
Expand Down