Skip to content

Using an array as the data source #199

Answered by TarekRaafat
TCRodriguez asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @TCRodriguez,

If your data is just an array of strings you'll just have to point the data.src to that array as shown below.

const tags = ["tag1", "tag2", "tag3"];

data: {
    src: tags
}

In case it's an array of Objects you'll need to add the key that the autoComplete.js engine will be looking for as shown below.

const tags = [{name: "tag1"}, {name: "tag2"}, {name: "tag3"}];

data: {
    src: tags,
    key: ["name"]
}

Try it, and let me know-how it goes.

Have a nice day! :)

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@TCRodriguez
Comment options

@TarekRaafat
Comment options

Answer selected by TarekRaafat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants