I want to pass data generated by jQuery into controller of AngularJS. Is there any way possible to do this.
<textarea ng-click="showSelectedText(selection.text)" name="editor1" id="editor1" cols="118" rows="35">
jQuery to gather Data:
$( "#editor1" ).select(function() {
var selection = getSelected()
if(selection)
{
alert(selection);
}
});
function getSelected() {
if (window.getSelection) {
return window.getSelection();
}
else if (document.getSelection) {
return document.getSelection();
}
else {
var selection = document.selection && document.selection.createRange();
if (selection.text) {
return selection.text;
}
return false;
}
return false;
}
Controller of AngularJS:
$scope.showSelectedText = function(fromUI) {
alert("Text is : "+ fromUI);
};