我有一个包含HTML实体的字符串,需要在控制器级别对其进行解码才能在输入中正确显示.在控制器级别上是否有等效的ng-bind-html?
$scope.create.name = 'Tobias's team from "Prague"';
<input type="text" ng-model="create.name" />
Run Code Online (Sandbox Code Playgroud)
我认为你需要使用用于解析html的ngSanitize.
<script src="angular.js">
<script src="angular-sanitize.js">
Run Code Online (Sandbox Code Playgroud)
然后在您的应用中包含清理模块
angular.module('app', ['ngSanitize']);
Run Code Online (Sandbox Code Playgroud)
参考:https://docs.angularjs.org/api/ngSanitize
| 归档时间: |
|
| 查看次数: |
4300 次 |
| 最近记录: |