簡體   English   中英

Angular UI Bootstrap 0.8.0手風琴未顯示IE8中的選定值

[英]Angular UI Bootstrap 0.8.0 accordion not showing selected value in IE8

我正在使用Angular UI Bootstrap 0.8.0和AngularJS 1.2.15來顯示手風琴中的某些內容。 一種手風琴包含帶有輸入/選擇元素的形式。 我正在選擇下拉列表,上面有一個帶有ng模型的國家/地區列表,以顯示所選值。 ng-model由select元素上的自定義指令“ initialize-model”初始化,該指令將模型初始化為HTML標簽的value屬性。 使用服務器端模板(ZPT)生成選項。 在選擇其他國家/地區的所有其他瀏覽器中,保存表單並再次打開頁面時,我會看到所選的國家/地區,但在IE8中,加載頁面時未正確設置ng-model,因此未選擇任何國家/地區。 如果我從手風琴中刪除選擇下拉列表,則IE8將顯示所選國家/地區。

我遵循了angular的IE實踐,包括document.createElement('accordion'); document.createElement('accordion-group'); document.createElement('accordion-heading'); 對於IE8,但IE8仍不顯示所選值。 當我打開IE8的開發人員工具並檢查元素時,我可以看到選擇中的選項顯示為已選中,但是ng-model並未設置為所選值。 我不知道是什么使ng-model在手風琴外面分配給選定的值? 我也嘗試過在角度來源之前加入jquery,但仍然無法解決問題。

模板如下所示:

<html>
<head>
  <!--[if lte IE 8]>
    <script>
      document.createElement('accordion');
      document.createElement('accordion-group');
      document.createElement('accordion-heading');
    </script>
  <![endif]-->
</head>
<body>
  <accordion>
    <accordion-group is-open="showSection">
      <accordion-heading>
        <i ng-class="{'icon-chevron-down': showSection, 'icon-chevron-right': !showSection}"></i>Country Information
      </accordion-heading>
      <select ng-model="selected_country" id="selected_country" name="selected_country" initialize-model>
        <option value="">---------</option>
        <options tal:omit-tag="" tal:repeat="country countries">
          <option tal:attributes="value country/code" tal:content="country/country"></option>
        </options>
      </select>
    </accordion-group>
  </accordion>
</body>
</html>

感謝您在這方面的幫助!

由於沒有人回答這個問題,因此我將發布如何解決IE8中的問題。

我在UI-Bootstrap手風琴的范圍之外創建了另一個HTML元素,例如:

<select ng-model="selected_country2" id="selected_country2" name="selected_country2" initialize-model>

initialize-model指令初始化了來自服務器的此下拉列表的值。

加載頁面時,我使用手風琴指令內的元素值(selected_country2)初始化了手風琴指令內的模型(selected_country)。 這樣,國家/地區的下拉菜單中就會填充來自指令外部元素的值。 當用戶更改國家/地區下拉列表時,將顯示一個scope。$ watch語句,該語句可在手風琴指令之外更新下拉列表的值,並且在使用更新后的值進行POST時將其轉到服務器。

PS:我確實查看過UI-bootstrap網站,但它並不正式支持IE8。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM