TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ahmed elbarbary
NA
1.6k
277.8k
Filter not work when text changed on autocomplete text box angular 7
Jun 5 2021 12:40 PM
I work on autocomplete text box on angular 7 I face issue when I write on text box
search or filter not work and not give me result .
actually when I write on text box auto complete related data must display but this not happen .
class
deliverysys.ts
export
class
deliverysys {
constructor(
public
optionId: number,
public
optionName: string) { }
}
DeliverySystemComponent.ts
export
class
DeliverySystemComponent
implements
OnInit {
myControl =
new
FormControl();
ExportOptions: deliverysys[];
constructor(
private
http: HttpClient,
private
_dataService: DeliverySysService) {
this
._dataService.getExport().subscribe(data => {
this
.ExportOptions = data
console.log(
this
.ExportOptions)
});
}
getselected(value,index) {
console.log(
"selected is"
+ index)
}
}
this display data as below :
this
.ExportOptions
(5) [{…}, {…}, {…}, {…}, {…}]
0: {optionID: 1, optionName:
"Export"
}
1: {optionID: 2, optionName:
"Export Normalized"
}
2: {optionID: 3, optionName:
"Export Normalized New"
}
3: {optionID: 4, optionName:
"Export Normalized Relation"
}
4: {optionID: 5, optionName:
"Export Nxp Comptitor"
}
DeliverySystemComponent.html
<mat-form-field
class
=
"example-full-width"
>
<input type=
"text"
placeholder=
"Select Exporter"
aria-label=
"Number"
matInput [formControl]=
"myControl"
[matAutocomplete]=
"auto"
>
<mat-autocomplete #auto=
"matAutocomplete"
>
<mat-option (click)=
"getselected(exp.optionName,i+1)"
*ngFor=
"let exp of this.ExportOptions;let i = index"
[value]=
"exp.optionName"
>
{{exp.optionName}}
</mat-option>
</mat-autocomplete>
</mat-form-field>
as you see image below when write any text not found
not give me not found
also if word I write found auto complete not changed and not give me related result
so How to solve issue of not displaying data related when I write or filter data ?
Reply
Answers (
0
)
How to get number of users as a count in a webpage in Angular?
What is AAA Testing in Angular?