We can process selected text by user in browser window. We need to use window.getSelection or document.selection. In below example, Mouse-Up event will be triggered when user selects the text, Then Angular function will process the selected text.
Markup
<div ng-mouseup="showSelectedText()"> Do you think that facebook, twitter............... </div> <div ng-bind="selectedText"></div>
Script
$scope.getSelectionText = function() { var text = ""; if (window.getSelection) { text = window.getSelection().toString(); } else if (document.selection && document.selection.type != "Control") { text = document.selection.createRange().text; } return text; };
Very nice, that's what I was looking for, thank you dude!
ReplyDeleteVery nice, that's what I was looking for, thank you dude!
ReplyDeleteThanks a lot for the helpful post!
ReplyDeleteThanks It is very useful for me.
ReplyDeleteUsted es Diabolico!!
ReplyDeleteGenial!
I love your creativity. Are you also searching for nursing writing services? we are the best solution for you. We are best known for delivering nursing writing services to students without having to break the bank.
ReplyDelete