Skip to content
This repository has been archived by the owner on Nov 22, 2021. It is now read-only.

Allow for custom tag and autocomplete templates #257

Closed
oO opened this issue Sep 20, 2014 · 5 comments
Closed

Allow for custom tag and autocomplete templates #257

oO opened this issue Sep 20, 2014 · 5 comments

Comments

@oO
Copy link

oO commented Sep 20, 2014

Is there a way ( short of forking the code ) to provide a custom template for both the tag and the autocomplete template? I'm using ngTagsInput as a multi-user selector for my application, but I would like to implement the following:

  1. Display the fullname, but trigger the ng-repeat on the username property. This is because the fullnames are not unique, but the usernames are. However, I still want to type the user's real name to find the tag, and not the username. Right now I'm getting the following error:
  2. Display a more complex autocomplete template, that contains the user icon, fullname and username.

Effectively a hybrid of ngTagInput and Angucomplete http://ghiden.github.io/angucomplete-alt

@duanefields
Copy link

There is displayProperty for the tag field, which lets use create a display value different from the value stored in your tag object. I think what we need is displayProperty for autocomplete as well so you could have an autocomplete displayProperty that gives different info. In my case, I'm autocompleting users, which each have their own ID, but the tag should just be the name, while autocomplete needs more information, such as their company name

@duanefields
Copy link

I've implemented something like this for myself on a branch. The tag now defines a keyProperty attribute which controls which field is used to determine unique tags, and the autocomplete tag now defines its own displayProperty. In my case autocomplete displays the full name and the company, while the tag cloud shows just their name and relies on an id field as the key, preventing conflicts from multiple John Smiths for example. Hopefully you will find his helpful @oO

https://github.com/glg/ngTagsInput
https://github.com/glg/ngTagsInput-bower

@mbenford
Copy link
Owner

Sorry for the late response.

Custom templates and a displayProperty option for the autoComplete directive are already part of the project backlog. See #99 and #152.

@mbenford
Copy link
Owner

Can this issue be closed?

@oO
Copy link
Author

oO commented Dec 17, 2014

Absolutely. Thanks.

On Dec 16, 2014, at 5:53 PM, Michael Benford [email protected] wrote:

Can this issue be closed?


Reply to this email directly or view it on GitHub.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants