Skip to content
This repository has been archived by the owner on Oct 7, 2020. It is now read-only.

Commit

Permalink
refactor(select): Make selectedText public variable (#302)
Browse files Browse the repository at this point in the history
  • Loading branch information
trimox authored Oct 21, 2017
1 parent a49c68f commit 2a4da68
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class SelectDemo {
isDisabled: boolean = false;
selectedValue: string;
closeOnScroll: boolean = true;
isDarkTheme: boolean = false;

foods = [
{ value: 'steak-0', description: 'Steak' },
Expand Down
6 changes: 3 additions & 3 deletions src/lib/select/select.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export class MdcSelectItem {
template:
`
<mdc-select-label *ngIf="!value">{{label}}</mdc-select-label>
<mdc-selected-text>{{_selectedText}}</mdc-selected-text>
<mdc-selected-text>{{selectedText}}</mdc-selected-text>
<mdc-select-menu>
<mdc-select-items>
<ng-content></ng-content>
Expand All @@ -132,11 +132,11 @@ export class MdcSelect implements AfterViewInit, ControlValueAccessor, OnDestroy
private _open: boolean = false;
private _label: string = '';
private _value: string = '';
private _selectedText: string = '';
private _uniqueId: string = `mdc-select-${++nextUniqueId}`;
private _menuFactory: any;
private _controlValueAccessorChangeFn: (value: any) => void = () => { };
onTouched: () => any = () => { };
selectedText: string = '';

@Input() id: string = this._uniqueId;
@Input() name: string | null = null;
Expand Down Expand Up @@ -217,7 +217,7 @@ export class MdcSelect implements AfterViewInit, ControlValueAccessor, OnDestroy
},
isMenuOpen: () => this._menuFactory.open,
setSelectedTextContent: (textContent: string) => {
this._selectedText = textContent;
this.selectedText = textContent;
},
getNumberOfOptions: () => {
return this.options ? this.options.length : 0;
Expand Down

0 comments on commit 2a4da68

Please sign in to comment.