根据此Link,需要将div设置为固定的高度,但是在此下面的代码中它不适用于此位置。
<div style="margin-top:0.5vh;">
<div style="height:200px;border:1px solid red;overflow:auto;" ng-init = "home_init()">
<ol>
<li ng-repeat= "site in sites">
<button ng-if="!(site.Initial===flash_site)" class="button button-block" style="background-color:#{{site.Color}};" ng-click="site_selected({{site}})">
<b>{{site.Name}}</b>
</button>
<button ng-if="(site.Initial===flash_site)" class="button button-block" style="background-color:#FFFFFF;">
<b>{{site.Name}}</b>
</button>
</li>
</ol>
</div>
</div>
试图做到这一点,
<div style="height:200px;overflow-y:auto;">
<div style="min-height:200px">
<div ng-repeat="site in sites">
</div>
</div>
</div>
和其他一些方法,真的不明白为什么div不包含ng-repeat元素。
请任何人能解释为什么?
图像
这是滚动条应位于红色边框上的位置。“皇后镇”隐藏在父div下方,红色边框下方。
更新
实际上,以下任何答案都是正确的,但是在我的代码中无法使用的正是这个罪魁祸首。启用了滚动类,并通过启用了滚动类,从而关闭了滚动,现在可以使用任何答案。
顺便说一句,谢谢您的时间和效果。欣赏它。
<button ng-if="!(site.Initial===flash_site)" class="button button-block" ng-style="{'background-color': site.Color}" ng-click="site_selected(site)">
ng-click="site_selected({{site}})
-您不需要{{}}
这里。
style="background-color:#{{site.Color}};"
-您也不需要{{}}
这里。
更改style
为ng-style
动态呈现颜色。
如果要使用颜色代码#
,请与color
ng-style="{'background-color': '#'+site.Color}"
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句