mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
doc(autocomplete-filter): Update example to use Array.prototype.Inclues() (#10779)
Was researching the Auto-complete feature to add it to a project and this little enhancement is more straightforward when dealing with more complex strings. Current example can't filter words with spaces. By using includes() it can filter full sentences.
This commit is contained in:
@@ -33,7 +33,7 @@ export class AutocompleteFilterExample {
|
||||
|
||||
filter(val: string): string[] {
|
||||
return this.options.filter(option =>
|
||||
option.toLowerCase().indexOf(val.toLowerCase()) === 0);
|
||||
option.toLowerCase().includes(val.toLowerCase()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user