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

Need to Set default Value in ngx-mat-select-search #147

Closed
sehgalneha opened this issue May 10, 2019 · 5 comments · Fixed by #148
Closed

Need to Set default Value in ngx-mat-select-search #147

sehgalneha opened this issue May 10, 2019 · 5 comments · Fixed by #148
Labels
feature New feature or request question

Comments

@sehgalneha
Copy link

I have Used ngx-mat-select-search for append the user list according to our project requirement. Need to Set text on the first load of page. The List is shown as according to search text but unable to set text on the ngx-mat-select-search . Please check out snippet.
image

Can you please provide the solution to set text on ngx-mat-select-search. I am looking forward for your response.

Thanks and Regards
Bhumika

@macjohnny macjohnny added not a bug question feature New feature or request and removed not a bug labels May 10, 2019
@macjohnny
Copy link
Member

can you please provide your sample code?
If I correctly understand your request, you are looking for a way to set the initial value of the search input field of <ngx-mat-select-search>?

Currently this is not possible, however it should be possible by adding a [value]="value" binding in

<input matInput
class="mat-select-search-input"

e.g.

<input matInput
         class="mat-select-search-input"
         [value]="value"

@sehgalneha would you like to provide a PR that implements this?

@macjohnny
Copy link
Member

macjohnny commented May 10, 2019

@sehgalneha I filed #148 to allow setting the initial value as simple as

public bankFilterCtrl: FormControl = new FormControl('my initial value');

Version 1.7.4 will be released soon

@sehgalneha
Copy link
Author

sehgalneha commented May 11, 2019

public bankFilterCtrl: FormControl = new FormControl('my initial value');

According to this we have set value in our control : "this.bankFilterCtrl.value"
But it will be not displayed in the HTML.
Like : [formControl]="bankFilterCtrl"
Can you Please confirm this?

@macjohnny
Copy link
Member

Yes, this should work after PR #148 being merged

macjohnny added a commit that referenced this issue May 13, 2019
#147: Allow setting the initial value of the search input
@macjohnny
Copy link
Member

this is released with version 1.7.4

public bankFilterCtrl: FormControl = new FormControl('my initial search value');

See this example: https://stackblitz.com/edit/github-zwffsh?file=src/app/examples/01-single-selection-example/single-selection-example.component.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request question
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants