mbenford / ngTagsInput

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

displayText that is treated as html not as text #329

Closed gae123 closed 9 years ago

gae123 commented 9 years ago

Currently the displayText is treated as text both in autocomplete and input-Tag. I would like to have it treated as simple html. This way one could color part of a tag, add Font Awesome characters etc. I guess this is a simplified version of request #257 but I think it is much easier to achieve, in fact I have a small patch that works.

mbenford commented 9 years ago

Yeah, that's easier to implement than #257, but I think of it as a kind of an advanced feature. I mean, I assume most people have a consistent model containing just data, not mixed with presentation rules.

I'll add this to the backlog so I can assess its viability later.

gae123 commented 9 years ago

Well, I wanted to do something as simple as what you see in the attached image, this required html to change the font. I have a small patch that works for me but I would need to add options for html vs. no html to keep it backwards compatible.

image

stijnbe commented 9 years ago

@gae123 are you able to post the patch here in this thread or even better, create a pull request?

gae123 commented 9 years ago

I guess I could but it is kind of a hack. It will only works if your items are not in HTML themselves. This is my case, so it works well but is not a general solution.

On Mar 9, 2015, at 9:12 AM, Stijn Beauprez notifications@github.com wrote:

@gae123 https://github.com/gae123 are you able to post the patch here in this thread or even better, create a pull request?

— Reply to this email directly or view it on GitHub https://github.com/mbenford/ngTagsInput/issues/329#issuecomment-77884894.

PK pk@gae123.com

mbenford commented 9 years ago

Custom template support for the autocomplete directive is already implemented in master. It'll be part of v2.3.0.

gae123 commented 9 years ago

This will be so awesome. Thanks

On Mar 19, 2015, at 4:53 PM, Michael Benford notifications@github.com wrote:

Custom template support for the autocomplete directive is already implemented in master. It'll be part of v2.3.0.

— Reply to this email directly or view it on GitHub https://github.com/mbenford/ngTagsInput/issues/329#issuecomment-83812755.

PK pk@gae123.com

mbenford commented 9 years ago

So, I went the extra mile and implemented custom template support for tags as well. Here's an animated gif of custom templates for tags and autocomplete:

Imgur

gae123 commented 9 years ago

Awesome!!!

On Mar 20, 2015, at 7:38 PM, Michael Benford notifications@github.com wrote:

So, I went the extra mile and implemented https://github.com/mbenford/ngTagsInput/commit/45e5d99809f66ea52e2206a476eb546867bbe4a8 custom template support for tags as well. Here's an animated gif of custom templates for tags and autocomplete:

https://camo.githubusercontent.com/bf48cdfac0bb11eaca884a4b9812c752e492e918/687474703a2f2f692e696d6775722e636f6d2f597956765675662e676966 — Reply to this email directly or view it on GitHub https://github.com/mbenford/ngTagsInput/issues/329#issuecomment-84222231.

PK pk@gae123.com

mbenford commented 9 years ago

v2.3.0 is already published on all distribution channels and it allows changing both tag and autocomplete templates. I'm working on the docs to explain how to create custom templates.

Can this issue be closed?

gae123 commented 9 years ago

I do think so but please let me download 2.3.0 and try it before I close it. Do you have an example in the test cases or somewhere else?

mbenford commented 9 years ago

You can take a look at the autocomplete specs. Hopefully you'll get how everything works. :)

gae123 commented 9 years ago

Looks good, I just switched to 2.3.0. I figured things out from the source code but some examples in the Demo section would be very welcome.