读取角度表达式json数据中的br或pre或html标记
to read br or pre or html tag in angular expression json data
/* sentence = "sdf vfgfhgjhkj,k ghhjjhjhjhj fgghghghgvvvv
ssdfgbghg vvffffffffffffffffffffffffbbbfbfffffffff
ccccccccccccccccccccccccccccccccccccccccccc"
<table class="table-responsive">
<th>notice</th>
<tr ng-repeat stment in data.note.statements>
<td>{{stment.sentence}}</td>
</tr>
</table>
我希望角度表达式能够按原样绑定json数据,换行符也会按原样出现。
首先用'n
:拆分长句
$scope.displayData = $scope.data.note.statements.split(''n');
然后在TABLE 中显示拆分数据
<table class="table-responsive">
<th>notice</th>
<tr ng-repeat="item in displayData">
<td>{{item}}</td>
</tr>
</table>
Manish,
不确定它会工作,但尝试使用:ng-bind-html
<table class="table-responsive">
<th>notice</th>
<tr ng-repeat="stment in data.note.statements">
<td ng-bind-html="'<pre>' + stment.sentence + '</pre>'"></td>
</tr>
</table>
相关文章:
- 如何停止CKEditor用<br>
- 高亮显示包含<br>以及重新格式化网格
- Jquery删除上面的br标记
- 读取角度表达式json数据中的br或pre或html标记
- 更改<pre>在文本区域更新时阻止内容
- jQuery:如何添加<br/>在不同的字符串中换行以分隔2中的句子
- 如何添加html<br>标记转换为javascript
- TinyMce not inserting <br />
- 在 Ember 1.0.0 pre 中路由时
- Pre 标记似乎忽略了样式属性(例如 display:none)
- iframe作为pre元素的嵌套元素
- 使用<代码>或者<pre>Jade模板中的标签
- CKEDITOR-<p>而不是<br/>导致复制粘贴问题
- 将换行符替换为<br/>并将其保存到数据库中
- 添加<pre>TinyMce 4中的标签按钮
- AngularJS中是否存在pre/post$apply挂钩
- 替换' '其中<br>在JavaScript中
- 发现<br>使用window.getSelection在wysiwyg编辑器中定位
- target string after second <br> jquery
- & lt; br>在alert()方法中删除PRE标记的内容