2016-06-17 34 views
0

我們一直在使用Angular-Strap警報服務來提醒,現在需要通過在警報打開後設置警報消息的焦點來使它們可訪問。Angular Strap Alert onShow函數沒有觸發

我已經嘗試添加一個onShow函數的警報選項,但onShow函數不會觸發。

我該如何得到這個工作?下面是選項配置

Itinerary.alertConflict = function() { 
    if ($rootScope.conflictShown) return false; 

    $rootScope.conflictShown = true; 
    $rootScope.conflictAlert = $rootScope.showAlert({ 
     template: '/Content/views/alerts/exhibition-conflict.html', 
     animation: 'am-fade-and-slide-top', 
     placement: 'top', 
     type: 'warn', 
     show: true, 
     onShow: function() { 
      alert('TEST'); 
      $timeout(function() { 
       var message = document.getElementById('alert'); 
       if (message !== null) { 
        message .focus(); 
       } 
      }); 
     } 
    }); 
} 

回答

1

添加bs-on-show="yourFunction"在HTML元素女巫屬性有bs-alert指令。 yourFunction應該在範圍內。

0

這是可能的,因爲角帶#2.3.9

+0

讓我知道要調用一個函數,如果我們想用下面#2.3.9版本。 – ARJUN