我们经常会遇到想要在网页中的文本进行换行的问题,普通的js加个<br/>就行,但是AngularJS却不能显示,所以针对AngularJS我的解决方法如下:

JS代码:

  $scope.trustAsHtml = $sce.trustAsHtml;

  $scope.text="hello<br/>xiaomi";

HTML代码:

  <div ng-model="text" ng-bind-html="trustAsHtml(text)">

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-06-19
  • 2022-01-04
  • 2022-12-23
  • 2021-05-26
猜你喜欢
  • 2022-12-23
  • 2021-09-29
  • 2021-11-22
  • 2021-11-11
  • 2021-05-10
  • 2022-12-23
相关资源
相似解决方案