Replace in angle

1
  

<br><br> This powerful creation - forged in the image of a gargoyle -    kept <br><br> safe in his journeys, allowing him to    to carry out their important work without fear of retaliation from those    hostile to their homeland. <br><br> That is, until the wrath of the    High Noxian Command with its sentinels. <br><br>

Using {{content.lore}} in my html displays the above text. When I try to use content.lore.replace("<br>", "") the words <br> are not replaced. How can I replace them?

    
asked by anonymous 28.02.2016 / 18:55

1 answer

2

One way is to use a filter that converts HTML to text:

app.filter('htmlToText', function(){
  return function(html){        
     return angular.element('<div>').append(html || '').text();
  };
});

In view:

{{content.lore | htmlToText}}
    
29.02.2016 / 13:58