In AngularJS, how do we insert a text, for example, I Want to insert text at position 7 with word "My "
Before
<textarea type="text">This is Text</textarea> After
<textarea type="text">This is My Text</textarea> You can try something like this.
$scope.text = $scope.insertText('This is Text', ' My', 7); $scope.insertText = function(source, text, position) { var subStr = source.substring(0, position); return subStr + text + source.substring(subStr.length); } <textarea type="text">{{text}}</textarea>