在控制器中我有一个变量说$ scope.question.
$scope.question = "Hi this is <br/> book";
在html页面中访问此变量,如{{question}}.
<div class="question">
        1. {{question}}
</div>
我想要输出换行...但它显示为字符串...如何解析html标签.
she*_*hen 11
你应该使用ng-bind-html指令.要利用它,您需要:
//1. given
.controller('AppController', [
  function() {
   $scope.SomeHtml = '<b>some html</b>';
//2. use ng-bind
 <div ng-bind-html="SomeHtml"></div>
从plnkr.co上的官方AngularJS文档中查看演示.
| 归档时间: | 
 | 
| 查看次数: | 14491 次 | 
| 最近记录: |