使用resolve
将数据发送到模态时遇到问题。
我有这个模板:
<div class="split wrapper" ng-app="myApp" ng-controller="appCtr">
<script type="text/ng-template" id="tablesModal">
<div class="modal-header modal-header-primary">
<h4 class="modal-title">{{ test }}</h4>
</div>
<div class="modal-body tables-list">
<ul>
</ul>
</div>
<div class="modal-footer">
<button class="btn btn-primary" ng-click="ok()">OK</button>
<button class="btn btn-warning" ng-click="cancel()">Cancel</button>
</div>
</script>
</div>
控制器:
var app = angular.module('myApp.controllers', ['ui.bootstrap']);
app.controller('appCtr', ['$scope', '$modal', function($scope, $modal) {
$scope.openCT = function(size){
var modalInstance = $modal.open({
templateUrl: 'tablesModal',
controller : 'appCtr',
size: size,
resolve: {
test: function(){
return 'example';
}
}
});
}
}]);
但我没有在模态标题中显示.. 我在这做错了什么?
答案 0 :(得分:1)
resolve()
处理程序时,将调用 then()
函数。
要解决问题,请在范围中添加test
:
$scope.test = "Modal Title";