我使用没有angular-ui模块的vanilla Angular JS。我在控制器上有一个对象$ 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">×</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>
试图在网上到处寻找答案但却找不到答案。真的很感激任何帮助。