garysieling / jquery-highlighttextarea

http://garysieling.github.io/jquery-highlighttextarea/
156 stars 75 forks source link

How can i change the highlight words dynamically? #66

Closed yobre closed 8 years ago

yobre commented 8 years ago

I want to highlight different words based on click events but i can't do it. When i click the button i change the $scope.options.words but nothing happens.

I created a gist for illustrate my problem. https://gist.github.com/yobre/1f820d94404a3d1c6f18

thanks

yobre commented 8 years ago

Thanks, i'm solved

      scope.$watch 'opts', (nVal, oVal) ->
        console.log("OlD --> ", oVal?.words, " - NEW --> ", nVal?.words);
        if !nVal || nVal == oVal
          return
        $(element).data('highlighter').setOptions nVal
        $(element).data('highlighter').highlight()