0

I am working on a project using AngularJs 1. I am looking for a library/tool which allows the user to click on any word of a text displayed and then allows him to categorize (tag) and highlight the word in order to its category. (Bonus: It would be nice to add categories on the go).

Does anyone know one or several JS libraries/ tools for that?

threxx
  • 1,213
  • 1
  • 31
  • 59

1 Answers1

1

It depends what you would like to have maybe you find AngularJS material as solution. I know it almost have a directive for text highlighting

And now, looking for it I have found ngTagsInput. It seems to be a tag directive as you wish.

If the reach is more specific you could try to get it by JS directly I think. Or doing your own directive.

What you could do in your case is add the directive when an event (onclick). Check how to dynamically add directive Or do your custom directive react to those events.

Community
  • 1
  • 1
Sam
  • 1,459
  • 1
  • 18
  • 32
  • I will look into those two! But how do I make every word in a text clickable? – threxx May 04 '17 at 20:29
  • 1
    To do every word clickable you can use JS split() method to parse the content of a div (using space character as separator) to individualize them by code. For example doing every word to be contained in a span dynamically changing html when text is edited or when page is loaded. Or saved by any reference. – Sam May 04 '17 at 21:13