Angularjs 在解除引导模式后,尝试在角度控制器内启动函数

Angularjs 在解除引导模式后,尝试在角度控制器内启动函数,angularjs,twitter-bootstrap-3,bootstrap-modal,angular-controller,Angularjs,Twitter Bootstrap 3,Bootstrap Modal,Angular Controller,我基本上是想弄清楚如何在angular控制器中执行某个事件侦听器。更具体地说,当取消引导模式时,我想在角度控制器中启动一个函数。在jquery中,您通常可以执行以下操作: $(.some-class).on('click', function() { // do something }); 我有一个侧面导航,上面有图像作为按钮。我有灰色按钮,当它们处于非活动状态时,红色按钮,当它们处于活动状态时。每个按钮启动一个引导模式 我正在使用: <a type="button" data-t

我基本上是想弄清楚如何在angular控制器中执行某个事件侦听器。更具体地说,当取消引导模式时,我想在角度控制器中启动一个函数。在jquery中,您通常可以执行以下操作:

$(.some-class).on('click', function() {
   // do something
});
我有一个侧面导航,上面有图像作为按钮。我有灰色按钮,当它们处于非活动状态时,红色按钮,当它们处于活动状态时。每个按钮启动一个引导模式

我正在使用:

<a type="button" data-toggle="modal" data-target="#overview" ng-click="launchOverview()">
    <img ng-src="{{ sideNavActive.overviewSrc }}" /><br />
  </a>
当用户单击其中一个侧导航按钮时,我有一个ng click功能,将按钮更改为“img/…-on.png”,因此按钮变为红色(活动)。当用户单击另一侧导航按钮时,该按钮变为红色,其余按钮变为灰色

我想做的是,当用户在模式周围的褪色区域中单击以取消它时,我还希望所有按钮都重置为灰色。根据引导文档,我应该能够在'hidden.bs.modal'事件上启动一个函数,但我无法在我的角度控制器中使其工作。我有以下函数,其中“#overview”是我的模态id

$('#overview').on('hidden.bs.modal', function() {
        console.log('function fired!!!!!I would use the angular-ui-bootstrap modal if you're not already: http://angular-ui.github.io/bootstrap/#!#modal. There is a callback function on the modal instance that is executed when the modal is dismissed:

modalInstance.result.then(function (someObj) {
      // success 
    }, function () {
      // this code will be executed when the modal is dismissed
      console.log('Modal dismissed at: ' + new Date());
    });
$(“#概述”).on('hidden.bs.modal',function(){

console.log('function fired!!!!!如果您尚未使用angular ui引导模式,我将使用该模式:。模式实例上有一个回调函数,该函数在模式解除时执行:

angular.element(document).find('.modal').on('hidden.bs.modal', function(){
  // do something
  console.log('function fired');
});

了解了当模态被解除时如何在角度控制器中启动函数


不要将jquery与angular@ThanhTùng那么我如何将其转换为angular?我已经完成:
angular.element(“#overview”).on('hidden.bs.modal',function(){console.log('function fired!!!!!您尝试使用
$scope.launchOverview=function(){}
angular.element(document).find('.modal').on('hidden.bs.modal', function(){
  // do something
  console.log('function fired');
});