我的 UI Bootstrap 模式有问题。
在一个控制器中我有这个:
app.controller("tableCtrl",['$scope','$http','$uibModal','$log' ,function ($scope, $http,$uibModal,$log) {
$scope.open = function (size,selectedUser) {
var modalInstance = $uibModal.open({
animation: $scope.animationsEnabled,
templateUrl: 'myModalContent.html',
controller:'ModalInstanceCtrl',
size: size,
resolve: {
user: function () {
return selectedUser;
}
}
});
}]);
在另一个我有这个:
app.controller('ModalInstanceCtrl',['$scope','$uibModalInstance','user', function ($scope, $uibModalInstance, user) {
$scope.user = user;
$scope.ok = function () {
$uibModalInstance.close();
};
}]);
myModalContent
看起来像这样:
<script type="text/ng-template" id="myModalContent.html">
<div class="modal-header"><h1>EDIT</h1></div>
<div class="modal-body">
{{patient.patient_id}}
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="button" ng-click="ok()">OK</button>
</div>
</script>
我只打电话tableCtrl
在 HTML 中并调用open
像这样的函数:
<button class="btn btn-primary" ng-click="open('lg',patient)">Edit</button>
当我单击编辑按钮时,我收到此异常:
Unknown provider: $uibModalInstanceProvider <- $uibModalInstance
I saw 这个笨蛋 http://plnkr.co/edit/khySg1gJjqz1Qv4g4cS5?p=preview但这对我没有帮助。
怎么了?