user2920788 user2920788 - 1 year ago 68
HTML Question

Replace text with angular

I am trying to replace certain values in a div using angular. The problem is that the div content is generated by an outside service so I cant just add

and be done with it. I've tried the following and some various variations with no luck

var o = angular.element(document.querySelector('#maintwo'));
var r = o[0].innerHTML.replace('TWO','REPLACE');
angular.element(document.querySelector('#maintwo')).innerHTML = r;


Answer Source

just remove angular.element() from this line, and it will work as you need it : angular.element(document.querySelector('#maintwo')).innerHTML = r;

Do it , like : document.querySelector('#maintwo').innerHTML = r;