mbenford / ngTagsInput

Tags input directive for AngularJS
http://mbenford.github.io/ngTagsInput
MIT License
1.64k stars 541 forks source link

JSON schema accepted should be explicitly documented #619

Closed MichaelArnoldOwens closed 7 years ago

MichaelArnoldOwens commented 8 years ago

Spent a couple hours just figuring out that:

[
{
"name": "California State University Stanislaus",
"name_map_id": "university-name-map:2412"
},
{
"name": "Staffordshire University",
"name_map_id": "university-name-map:3376"
},
{
"name": "Stamford College",
"name_map_id": "university-name-map:5544"
},
{
"name": "Pennsylvania State University-Penn State Berks",
"name_map_id": "university-name-map:10813"
},
{
"name": "Pennsylvania State University-Penn State Shenango",
"name_map_id": "university-name-map:11496"
},
{
"name": "Stark State College of Technology",
"name_map_id": "university-name-map:35576"
},
{
"name": "Kent State University at Stark",
"name_map_id": "university-name-map:44196"
}
]

Is not acceptable because the format must be in

[{"text":value}, ...]

ngTagsInput should be more robust in that if I specify a key to be source for suggestions, then it shouldn't default setting the key to undefined.

mbenford commented 8 years ago

No predetermined schema is required. You can tell ngTagsInput to use any property of your model by setting either keyProperty or displayProperty, depending on what you want to do. Take a look at the docs and at the demos page.

MichaelArnoldOwens commented 8 years ago

I did look at the docs and the demo, which is why I was confused and surprised to find that it worked differently than what was demoed.

Before changing all the keys to 'text', I was getting duplicate error key: undefined logs in my console.

MHaendel commented 8 years ago

" You can tell ngTagsInput to use any property of your model " - if it's not nested.

I wish to set displayProperty to displayProperty="tag.name"

Tagging:

mbenford commented 7 years ago

This issue was selected to be spring-cleaned by a script. More information can be found here.

If anyone thinks this was a mistake and this issue should be reopened, please leave a message below explaining why. Before doing so, please consider reading the CONTRIBUTING file.