AngularJS-关闭模式窗口

AngularJS-关闭模式窗口,angularjs,twitter-bootstrap,angular-ui-bootstrap,Angularjs,Twitter Bootstrap,Angular Ui Bootstrap,我的包括: bootstrap.css [ getbootstrap.com/2.3.2 ] angular/ui-bootstrap-tpls-0.10.0.min.js from: [ angular-ui.github.io/bootstrap ] 我正在使用AngularJS和Twitter引导程序。 从AngularJS中,我打开模式窗口,如下所示: 我的模式模板是: < &时代; ..... 问题: 关闭[x]按钮不工作 当我点击它时,模态不会消失。但当我按下Esc键时,模式

我的包括:

bootstrap.css [ getbootstrap.com/2.3.2 ]
angular/ui-bootstrap-tpls-0.10.0.min.js from: [ angular-ui.github.io/bootstrap ]
我正在使用AngularJS和Twitter引导程序。

从AngularJS中,我打开模式窗口,如下所示:

我的模式模板是:


<
&时代;
.....

问题:
关闭[x]按钮不工作
当我点击它时,模态不会消失。但当我按下Esc键时,模式消失。

看来。。。data DISCLESH=“modal”不工作。有什么想法吗?

引导javascript使用了
data
属性(正如我看到的,html源代码来自,)

UI引导将不会绑定到该关闭按钮,因为它不寻找该属性,您需要添加一个ng单击并取消该模式,如示例中所示

在控制器中:

$scope.cancel = function () {
    $modalInstance.dismiss('cancel');
};
模态模板

<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
取消

在angular中,有一个
关闭
方法
$modalInstance
关闭打开的模式窗口

控制器:

  $scope.closeMyPopup = function () {
    $modalInstance.close();
  };

我使用jQuery和Angular这样做:

jQuery('#YOURMODALID').modal('hide');

我假设你正在使用angular ui的ui引导打开modalJeremyWeir:请注意……我在问题中添加了包含(css/js)。我的包含组合是否错误?我在twitter引导(css/js)和角度引导(css/js)之间有点迷茫。你必须将
ng click
添加到你的
X
按钮中。在
ng click
中调用一个关闭模式的函数。如果可能,我会鼓励升级到bootstrap v3。我包括:bootstrap.css[],我有来自:[]的angular/ui-bootstrap-tpls-0.10.0.min.js,这是错误的组合吗?要使数据正常工作,我需要什么?如果您使用的是angular ui bootstrap lib,则不希望包含bootstrap.js。使用ng click处理程序关闭对话框,如示例所示。您不需要将jQuery与Angular一起使用。也不是最佳实践。见公认的答案。
  $scope.closeMyPopup = function () {
    $modalInstance.close();
  };
jQuery('#YOURMODALID').modal('hide');