0

We have a legacy system that uses AngularJS.

I have been tasked with creating mentions in a textarea and use those mentions in the back end for various secondary purposes such as notifications and alerts.

I have script that will lookup users at the beginning of the text area. However I need to be able to have multiple lookups, invoked at any point in the textarea, as there will be multiple mentions. I wish to use the "@" symbol to invoke the angularJS ui control that is provided.

I have not been able to find anything that is able to do this, although some folk get close.

            <textarea ng-model="NoteToAdd" class="form-control" rows="4"
                      uib-typeahead="u.MentionableHandle as (u.MentionableHandle + ': ' + u.FirstName + ' ' + u.LastName) for u in mentionable | filter:$viewValue | limitTo:8"
                      select-on-click
                      typeahead-loading="loading" typeahead-no-results="noResults"
                      autocomplete="off">
             </textarea>

This thread suggests using a filter for ensuring a match on the first character, is this a possible place to start?

Cheers Wee.

WeePecky
  • 57
  • 1
  • 8

1 Answers1

0

I have figured this out.

I have a filter method in my controller that returns the required matches as the user types. It will not return any matches if a user does not start the mention with an "@" - I also need an on selected method that will append the new mention text into the textarea.

Simple if you know how.

Wee.

WeePecky
  • 57
  • 1
  • 8