简体   繁体   English

angularjs范围内的HTML标签

[英]HTML tag in scope of angularjs

我需要在控制器的$ scope.myText中放入<br />标签,该怎么做?

Something like $sce.trustAsHtml("<br />") should work. $sce.trustAsHtml("<br />")应该可以工作。

$sce.trustAsHtml() returns a string that is safe to use with ng-bind-html . $sce.trustAsHtml()返回可与ng-bind-html一起安全使用的字符串。 You can read more about it here 你可以在这里读更多关于它的内容

$sce.trustAsHtml vs. ng-bind-html $ sce.trustAsHtml与ng-bind-html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM