Angularjs 引导模式组件未显示来自角度控制器的数据

Angularjs 引导模式组件未显示来自角度控制器的数据,angularjs,twitter-bootstrap,angularjs-scope,Angularjs,Twitter Bootstrap,Angularjs Scope,我使用的是香草Angular JS,没有Angular ui模块。我在控制器上有一个对象$scope.spotDetails。我确认里面有数据。我想在视图上显示这些数据,该视图在模态上绑定到此控制器。页面的其余部分显示来自控制器的其他数据,但当我打开模式时,它不会显示来自上述对象的数据 这是控制器代码 chaloApp.controller('planController', ['$scope', '$rootScope', '$http', '$cookies', '$location', '

我使用的是香草Angular JS,没有Angular ui模块。我在控制器上有一个对象$scope.spotDetails。我确认里面有数据。我想在视图上显示这些数据,该视图在模态上绑定到此控制器。页面的其余部分显示来自控制器的其他数据,但当我打开模式时,它不会显示来自上述对象的数据

这是控制器代码

chaloApp.controller('planController', ['$scope', '$rootScope', '$http', '$cookies', '$location', '$compile', function($scope, $rootScope, $http, $cookies, $location, $compile){


      $scope.spot = {};
      //the object which holds the getDetails method call response from Google
      $scope.spotDetails = {};
.....
模态HTML

......
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
                   <div class="modal-dialog" role="document">
                     <div class="modal-content">
                       <div class="modal-header">
                         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                         <h4 class="modal-title" id="myModalLabel"></h4>
                       </div>
                       <div class="modal-body">
                         {{ spotDetails.name }}
                       </div>
                       <div class="modal-footer">
                         <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                         <button type="button" class="btn btn-primary">Save changes</button>
                       </div>
                     </div>
                   </div>
                 </div>
。。。。。。
&时代;
{{spotDetails.name}
接近
保存更改

我一直在网上到处寻找答案,但找不到答案。非常感谢您的帮助。

您的模态元素是否在控制器元素下?您需要将模态元素放置在控制器元素下,以便在模态中使用控制器的作用域。不过我建议您使用ui引导。@ShuheiKagawa…我开始研究角度ui引导,因为我认为这一定是因为Modal不属于范围的一部分。我将使用ui引导,谢谢。我正在加载带有角度布线的视图,并将其与控制器连接,因此仍然不确定为什么它不应该工作。模态不是它通常嵌入的视图范围的一部分。我在某个地方读到过,我可能需要编译它,以便它成为范围的一部分。