Using HTML Entities within Angular strings

后端 未结 2 749
情歌与酒
情歌与酒 2020-12-03 21:09

Given a string in my $scope model which contains an HTML entity, how do I ensure that the entity is properly displayed as an HTML character rather than a literal string?

2条回答
  •  鱼传尺愫
    2020-12-03 21:39

    With $sce. You need to explicitely tell angular the content is html.

    http://plnkr.co/edit/9iNnRC7AxFptnQZLPtYR?p=preview

提交回复
热议问题