首页 \ 问答 \ ng-bind-html-unsafe无法正常工作(ng-bind-html-unsafe not working)

ng-bind-html-unsafe无法正常工作(ng-bind-html-unsafe not working)

我已将角度版本从1.0.8升级到1.4.0。

我用ng-bind-html-unsafe="value | noHTML | newlines"来包装一个字符串。 自新版本以来,这不起作用。

我尝试使用以下解决方案,但仍然无法正常工作。

app.filter('unsafe', function($sce) { return $sce.trustAsHtml; });

ng-bind-html-unsafe="value | unsafe | noHTML | newlines"

I have upgraded the angular version from 1.0.8 to 1.4.0.

I have used ng-bind-html-unsafe="value | noHTML | newlines" to wrap down a string. This is not working since the new version.

I tried using the following solution, but still not working .

app.filter('unsafe', function($sce) { return $sce.trustAsHtml; });

and

ng-bind-html-unsafe="value | unsafe | noHTML | newlines"

原文:https://stackoverflow.com/questions/37184031
更新时间:2023-10-11 19:10

最满意答案

来自完美滚动条的文档

以下要求应符合:

  1. 容器必须具有位置样式。**

所以你需要的一切就是为容器添加一个位置样式:

.select2-results__options {
  position: relative;
}

更新小提琴


From perfect-scrollbar's documentation:

The following requirements should meet:

  1. The container must have a position style.**

So everything you need is to add a position style to container:

.select2-results__options {
  position: relative;
}

Updated fiddle

相关问答

更多
  • 问题是你的#formdiv是100%高度所以它比它的父本身更大。 如果您知道#tabheader的高度,例如在jsfiddle中高度为24px,那么当您将#formdiv的高度更改为height: calc(100% - 24px); 它运作正常。 The problem is that your #formdiv is 100% height so it becames bigger than its parent itself. If you know the height of the #tabhea ...
  • 您在容器上设置了200px的宽度。 这迫使包装。 为防止这种情况,请使用white-space属性: .container { ... white-space: nowrap; } 演示 You've set a width of 200px on the container. This forces wrapping. To prevent that, use the white-space property: .container { ... white-space: ...
  • 来自完美滚动条的文档 : 以下要求应符合: 容器必须具有位置样式。** 所以你需要的一切就是为容器添加一个位置样式: .select2-results__options { position: relative; } 更新小提琴 From perfect-scrollbar's documentation: The following requirements should meet: The container must have a position style.** So everything ...
  • 对于第二个hbox子面板替换width: '100%',其中flex: 1, 滚动条在那里,它只是在可见区域之外。 另外,如果在父面板的vbox布局配置中指定align: 'stretch' ,则可以省略width: '100%',对于“更改”和“包”网格,这意味着子项目将水平拉伸到填充父容器的宽度。 https://fiddle.sencha.com/#view/editor&fiddle/1nht For the second hbox child panel replace width: '100%' ...
  • 你可以添加一个类似的填充到.wrapper:hover来修复它。 这只是一个解决方法 。 *,*:before,*:after {box-sizing:border-box;} .wrapper{ position:relative; width:460px; border:1px solid black; padding: 0 8px; margin: 0; height: 600px; overflow:hidden; } .wrapper:hov ...
  • 你可以在div上使用{overflow-y:scroll;}来表示滚动部分。 或者您可以在db查询中使用分页,因此如果您不想滚动,则每页只有一定数量的结果。 well you could use {overflow-y:scroll;} on a div for the scroll part. Or you could use pagination in you db query, so you only have a set number of results per page if you dont ...
  • 你有position: relative; left: 50px; 在#menuToggle 。 这会将#menuToggle向右#menuToggle 50px,在窗口外面。 您可以改为使用该元素的边距。 删除top, left并添加margin: 50px 0 0 50px; https://codepen.io/anon/pen/NdGYyw You have position: relative; and left: 50px; on #menuToggle. That pushes #menuTo ...
  • 最终我找到了解决方案。 如果它是滚动的body标签,则每个背景条的宽度可以设置为100vw(包括滚动条的窗口宽度),然后可以在body标签上设置overflow-x:hidden以删除水平滚动条。 如果正在进行滚动的正文,这个解决方案似乎才有效。 使用overflow-x:hidden的任何其他div都会使滚动条下的任何内容消失,无论出于何种原因,这都不会发生在body标签上。 示例html文件: