【问题标题】:Select option goes beyond display选择选项超出显示范围
【发布时间】:2016-12-09 05:37:35
【问题描述】:

我正在使用选择标签来显示下拉菜单。在选项标签中,我正在做 ng-repeat。如果在那个ng-repeat 中,假设有一个很长的字符串maxlength=255,我怎么能分成几行。因为它溢出了屏幕。

screenshot

<div class="col-sm-5">
  <select id="alert" name="alert" ng-model="dropdownSelectedRegion" ng-change="regionSelected(dropdownSelectedRegion)" class="admin-select-btn sans-regular-11 disposition" required>
     <option value="">Select</option>
     <option value="{{region.id}}" ng-selected="dropdownSelectedRegion==region.id" ng-repeat='region in RegionList'>{{region.description | subStringFilter}}</option>
  </select>
</div> 

【问题讨论】:

  • 请分享一段完整的代码。另外,请同时包含 css(最好是 JS),因为听起来您的解决方案应该在 css 中解决

标签: javascript angularjs angularjs-directive angularjs-ng-repeat


【解决方案1】:

通常你不能用 html 来破坏,通常我将 title 属性设置为 long text 并使用简短的 description 作为我的值。

<option value="1" title="Huge Description">your value</option>

这是一个找到的小提琴,可以帮助你:

http://jsfiddle.net/ZTs42/2/

【讨论】:

  • 我也试过了。但它不适用于动态数据。
  • 是的。确切地。如果我渲染动态数据,它对我不起作用
猜你喜欢
  • 2013-05-10
  • 1970-01-01
  • 1970-01-01
  • 2017-02-26
  • 1970-01-01
  • 2017-09-06
  • 2016-07-10
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多