I am building an application in which user can select a word from the article displayed on a webpage, I save that word in the database for later use.
Which event can I use so that I can get which word the user has selected. I am using AngularJS. Below is a code which I found in jQuery, how can I write equivalent AngularJS code
$(document).ready(function() {
var p = $('p');
p.css({ cursor: 'pointer' });
p.dblclick(function(e) {
var range = window.getSelection() || document.getSelection() || document.selection.createRange();
var word = $.trim(range.toString());
if(word != '') {
alert(word);
}
range.collapse();
e.stopPropagation();
});
});