Provide support to search the available options, autocomplete feature.
See (https://mseemann.io/angular2-mdl/select) for details
This is very doable as is. It's not really their job to figure this out. and it's not a lot of code to do this.Heres a simple employee search
.TS:
ngOnInit() {
this.employeeInfo$ = this.searchAssociates.pipe(
debounceTime(300),
distinctUntilChanged(),
switchMap((searchValue: string) => this.searchService.EmployeeSearch(searchValue).pipe(
map(res => _.uniq(res.employeeSearch)),
)),
);
}
public searchEmployees(searchValue: string): void {
if (searchValue.length > 2) {
this.searchAssociates.next(searchValue);
}
}
displayFn_employee(employee?: IEmployee): string | undefined {
return employee ? employee.name : undefined;
}
.HTML:
<mat-autocomplete #auto="matAutocomplete" [displayWith]="displayFunction ? displayFunction : displayFn_employee" (optionSelected)="onOptionSelected($event.option.value)">
<mat-option *ngFor="let option of employeeInfo$ | async" [value]="option">
{{ option.name }}
</mat-option>
</mat-autocomplete>
@sollenne with respect, I think you are missing the whole point of using components, probably most programmers who come here are able to create the whole angular material from scratch, give or take, but why we don't do it? because we all want to focus on our own business domain, and providing search for a combo box is not my domain problem, it's a must have need, but it's not specific to my domain, everybody needs it, so i think it should be part of the core.
@gmareater he wants someone to write his code for him and I just did, and did it in an extremely easy-to-understand way. I have npm packages and understand that people will ask for features beyond the intent of the project. They made an awesome component and gave you the tools to scale it to your circumstance. An even easier way is to pull down all the state data and use that instead of making an api call on search but he didn鈥檛 ask for that. Giving me a thumbs down for helping him solve his problem by pointing out that he can already do what he鈥檚 requesting hardly seems worth the effort you put into your comment. Good job.
Chill guys..
@sollenne why r u making a big deal of it, it's a simple needed feature "Provide support to search the available options"
sorry bro, but providing code and solution is for SO, here you agree or disagree to help maintainers decides it's needed or not.
I will use your code for my problem, it's nice and acceptable but missing point in my belief is this: if i need this feature for almost all of my dropdowns, it should be part of framework. i hate to repeat myself.
Guys, let the maintainers decide whether this feature is worth implementing. Peace
Duplicate of #5697
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._
Most helpful comment
This is very doable as is. It's not really their job to figure this out. and it's not a lot of code to do this.Heres a simple employee search
.TS:
.HTML: