Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/90.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 未在div内呈现Html标记(ckeditor)_Javascript_Html_Angularjs_Ckeditor - Fatal编程技术网

Javascript 未在div内呈现Html标记(ckeditor)

Javascript 未在div内呈现Html标记(ckeditor),javascript,html,angularjs,ckeditor,Javascript,Html,Angularjs,Ckeditor,我正在使用ckeditor获取用户在文本区域中输入的内容,但是当我想在页面中显示/呈现该字段时,它只显示html标记,而不是呈现的标记! 这很奇怪,因为偶数标记并没有被转义,所有东西看起来都像是一个纯html语法,只是没有呈现出来! mongodb中存储的内容如下: "longDesc" : "<p style=\"text-align: left;\">We need creation of <strong>7 animated banners</strong&g

我正在使用ckeditor获取用户在文本区域中输入的内容,但是当我想在页面中显示/呈现该字段时,它只显示html标记,而不是呈现的标记! 这很奇怪,因为偶数标记并没有被转义,所有东西看起来都像是一个纯html语法,只是没有呈现出来! mongodb中存储的内容如下:

"longDesc" : "<p style=\"text-align: left;\">We need creation of <strong>7 animated banners</strong>.</p>\n\n<p style=\"text-align: left;\">We need to remake to dynamic form. We provide you open source data and technical specifications.</p>\n"
而输出正好是:

<p style=\"text-align: left;\">We need creation of <strong>7 animated banners</strong>.</p>\n\n<p style=\"text-align: left;\">We need to remake to dynamic form. We provide you open source data and technical specifications.</p>\n

我们需要创建7个动画横幅

\n\n

我们需要重新制作为动态形式。我们为您提供开源数据和技术规范。

\n
看一看。你只需要:

$scope.myHTML = '<p>test</p>';

....

<div ng-controller="ExampleController">
 <p ng-bind-html="myHTML"></p>
</div>
$scope.myHTML='test

'; ....

您需要在应用程序依赖项中包含ngSanitize,以使ng绑定html正常工作。以下是一个Plunker示例:


它没有显示任何内容!标记的属性更改为ng binding,但不返回任何值。甚至我测试过使用一个过滤器返回$sce.trustAsHtml(文本),但它不起作用。Ng bind html不安全不起作用,camel案例也不起作用。Eddit用一个例子来说明我的答案
$scope.myHTML = '<p>test</p>';

....

<div ng-controller="ExampleController">
 <p ng-bind-html="myHTML"></p>
</div>