2016-06-17 37 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