簡體   English   中英

ng-單擊Bootstrap Rating

[英]ng-click with Bootstrap Rating

我有一個Bootstrap Rating組件,我必須使用on-leave方法來調用我的javascript函數。 除IE外,其他所有瀏覽器都在click事件上執行“離開”功能。 但是在IE中,直到我離開stars'div為止,該函數才被調用。 我什至不能使用ng-click,因為Bootstrap Rating組件不支持它(我的角度版本為1.1.5)

<div id="ratingDiv{{$index}}" style="display:none;" class="ratingDivClass">
<span class="ratingPoorClass">Poor</span>
<rating id="rateStars" onclick="$jq('#loader').show();" value="userRating" max="5" 
on-hover="hoveringOver(value)" 
on-leave="saveRating(message.id,userRating,$index,message.entity);"></rating>
<span class="ratingGoodClass">Very Good</span>
</div>

問題:在IE中,直到我離開div為止,該函數未被調用

嘗試過:

  1. 單擊而不是離開時調用函數:不傳遞與范圍相關的參數
  2. 單擊div時觸發mouseleave()方法:不起作用:(

請讓我知道是否有人對此有任何解決方案。

我在angularjs和IE中遇到了類似的問題。 就我而言,按下按鍵無效,解決方案是使用按下按鍵事件(請參閱http://api.jquery.com/keyup/ )。

就您而言,您可能遇到此問題https://github.com/angular/angular.js/issues/1277

我不熟悉上面的“ on-leave”,但是您可以嘗試使用jquery blur方法: https : //api.jquery.com/blur/

根據ng-mouseleave的文檔,您可以嘗試以下代碼。

在我的上一個項目中,我使用了下面的IE8代碼來支持某些功能。.您也可以嘗試離開。

<!--[if lte IE 8]>
  <script>
    document.createElement('ng-include');
    document.createElement('ng-pluralize');
    document.createElement('ng-view');   
    document.createElement('alert');
    document.createElement('progress');
    document.createElement('ng-mouseleave');// try this

    // Optionally these for CSS
    document.createElement('ng:include');
    document.createElement('ng:pluralize');
    document.createElement('ng:view');
  </script>
<![endif]-->

暫無
暫無

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

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