Currently, I am encountering an issue while utilizing the Angular mention library.
Below is the typescript code I am working with:
items: Object[] = ["jay","roy","gini","rock","joy","kiya"];
I am utilizing the array named items
in my component.html file
<input type="text" id="cname" name="cname" placeholder="Type Here.." [mention]="items">
When typing in the text box, the library provides suggestions based on the typed characters. For example, typing @j
will suggest names starting with j
and inserting them with the @
sign. This feature allows for auto searching through the array, facilitated by importing the mention library into my Angular7 application.
As part of a project where user data is retrieved from a web service, I need to populate the items
array with these users.
The JSON data structure is as follows:
[
{
"attributes": {
"User": "jay"
}
},
{
"attributes": {
"User": "roy"
}
},
{
"attributes":{
"User": "kiya"
}
},
{
"attributes":{
"User": "gini"
}
},
{
"attributes": {
"User": "rock"
}
},
{
"attributes": {
"User": "joy"
}
}
]
This JSON data retrieved from the web server is stored in a variable and I aim to incorporate it into the items
array to enable accurate auto suggestions in the text box.
Despite my attempts, I am currently experiencing issues with the suggestions not appearing while typing in the text box.