我正在使用 angular bootstrap ui modal,它工作正常,但是当我尝试使用 modalInstance 关闭它时,它给出了上述错误。这是我的代码
var app = angular.module('LoginModule', ['ui.bootstrap']);
app.controller('LoginModal', ['$scope', '$modal', function ($scope, $modal) {
$scope.animationsEnabled = true;
$scope.open = function (size) {
var modalInstance = $modal.open({
animation: $scope.animationsEnabled,
templateUrl: '/app/template/Login.html',
controller: 'LoginController',
size: size
});
}
}]);
app.controller('LoginController', ['$scope', '$modalInstance', '$http', function ($scope, $modalInstance, $http) {
$scope.model = {};
$scope.loading = {
state: false
}
$scope.errors = '';
$scope.email = "";
$scope.cancel = function () {
$modalInstance.dismiss('cancel');
};
}]);
Run Code Online (Sandbox Code Playgroud)
我在我用模板指定的控制器中创建了取消函数,但它仍然给出错误。我在 LoginController 内的按钮中使用 ng-click="cancel()" 。需要帮忙?
modal-dialog twitter-bootstrap angularjs angular-ui-bootstrap