Javascript Angularjs Select在模式窗口中不起作用

Javascript Angularjs Select在模式窗口中不起作用,javascript,angularjs,twitter-bootstrap,Javascript,Angularjs,Twitter Bootstrap,你好 我正在使用angularJs和bootstrap开发一个web应用程序。 在模式窗口中使用select时出现问题。 下面是一个plunker文件的链接。 只是想让你了解我的问题。我不能把真正的代码,因为它是一个秘密的大学项目。我无法在plunker中生成一个不起作用的类似代码 angular.module'plunker',['ui.bootstrap']; var ModalDemoCtrl=函数$scope、$modal、$log{ $scope.items=[item1、item2

你好 我正在使用angularJs和bootstrap开发一个web应用程序。 在模式窗口中使用select时出现问题。 下面是一个plunker文件的链接。 只是想让你了解我的问题。我不能把真正的代码,因为它是一个秘密的大学项目。我无法在plunker中生成一个不起作用的类似代码

angular.module'plunker',['ui.bootstrap']; var ModalDemoCtrl=函数$scope、$modal、$log{ $scope.items=[item1、item2、item3]; $scope.open=函数{ var modalInstance=$modal.open{ templateUrl:'myModalContent.html', 控制器:ModalInstanceCtrl, 决心:{ 项目:功能{ 返回$scope.items; } } }; }; }; var ModalInstanceCtrl=函数$scope、$modalInstance、项{ $scope.items=项目; $scope.ok=函数{ $modalInstance.close$scope.items; }; $scope.cancel=函数{ $modalInstance。取消“取消”; }; }; angular.module'plunker',['ui.bootstrap']; var ModalDemoCtrl=函数$scope、$modal、$log{ $scope.items=[item1、item2、item3]; $scope.open=函数{ var modalInstance=$modal.open{ templateUrl:'myModalContent.html', 控制器:ModalInstanceCtrl, 决心:{ 项目:功能{ 返回$scope.items; } } }; }; }; var ModalInstanceCtrl=函数$scope、$modalInstance、项{ $scope.items=项目; $scope.ok=函数{ $modalInstance.close$scope.items; }; $scope.cancel=函数{ $modalInstance。取消“取消”; };
}; 我找到了解决我问题的办法。通过引导,我们可以创建模式窗口,而无需在javascript文件中声明任何内容。为此,我们必须在使用它的html文件中包含模式窗口。 这是一个显示解决方案的示例,与上面的示例不同: 此代码打开模式:

<div ng-include="getItemTemplate('modalVariables')"></div>
<button type="button" class="btn btn-primary btn-section" data-toggle="modal" data-target="#variablesModal">Variables</button>
在模式中,我们有:


有了这个代码,模态中的一个select就可以正确地为我工作了。但我仍然不知道为什么它以前不起作用。

你说不能选择任何东西是什么意思?select被阻止了还是不接受您的更改?select被阻止了。我可以看到不同的选项,但当我点击选择一个时,什么都没有发生。我发现了一些非常奇怪的事情。我有一个和我一样使用firefox的朋友。在他的电脑上,他可以正常使用select。他可以用完全相同的代码选择任何他想要的值。我们有相同版本的firefox。唯一不同的是操作系统。他用的是Windows8,我用的是ubuntu 14.04。问题是否可能由此产生?这是可能的,因为浏览器将在每个平台上使用不同的本机库。您是否使用firebug检查HTML代码,或者firefox中当前的调试工具是什么。如果你检查你的下拉列表,它会在firebug中被选中,还是会有一个不可见的div覆盖?没有覆盖div,并且它不会在firebug中被选中。对于相同的代码,除了两个不同窗口中选择的ng模型,一个是模态,另一个不是模态,我在firebug中有完全相同的代码。我可以在普通窗口中选择我想要的任何内容,但选择在模式中不起作用。
<div class="modal fade" id="variablesModal" role="dialog" aria-labelledby="modalTitle" aria-hidden="true" tabindex="-1">
<!-- content of the modal window here -->
</div>