模态实例不解析输入
Modal Instance not resolving input
我正在尝试使用 AngularUI 模态,但我似乎无法弄清楚为什么它没有解析我的变量。
打开模态和模态实例的函数
$scope.openModal = function (size, cert) {
var modalInstance = $modal.open({
template: 'ModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
certs: function () {
return $scope.certification;
}
}
});
modalInstance.result.then(function () {});
};
Modal Controller 这里有些东西是debugging遗留下来的
angular.module('myApp').controller('ModalInstanceCtrl', ['$scope', '$filter', '$modalInstance', function ($scope, $filter, $modalInstance, certs) {
console.log(certs);
var results = $filter('filter')(certs, {id: id})[0];
$scope.cert = results;
$scope.ok = function () {
$modalInstance.close();
};
}]);
主要问题是,当它进入控制器时,我的证书未定义,即使它应该由 openModal 函数解决。我正在关注官方 angular UI 教程,了解如何在此处进行操作:Angular UI Bootstrap Modals
在将 'certs' 注入到控制器中时,您需要将其添加到名称声明和函数中。
angular.module('myApp').controller('ModalInstanceCtrl', ['$scope', '$filter', '$modalInstance', 'certs', function ($scope, $filter, $modalInstance, certs) {
我正在尝试使用 AngularUI 模态,但我似乎无法弄清楚为什么它没有解析我的变量。
打开模态和模态实例的函数
$scope.openModal = function (size, cert) {
var modalInstance = $modal.open({
template: 'ModalContent.html',
controller: 'ModalInstanceCtrl',
size: size,
resolve: {
certs: function () {
return $scope.certification;
}
}
});
modalInstance.result.then(function () {});
};
Modal Controller 这里有些东西是debugging遗留下来的
angular.module('myApp').controller('ModalInstanceCtrl', ['$scope', '$filter', '$modalInstance', function ($scope, $filter, $modalInstance, certs) {
console.log(certs);
var results = $filter('filter')(certs, {id: id})[0];
$scope.cert = results;
$scope.ok = function () {
$modalInstance.close();
};
}]);
主要问题是,当它进入控制器时,我的证书未定义,即使它应该由 openModal 函数解决。我正在关注官方 angular UI 教程,了解如何在此处进行操作:Angular UI Bootstrap Modals
在将 'certs' 注入到控制器中时,您需要将其添加到名称声明和函数中。
angular.module('myApp').controller('ModalInstanceCtrl', ['$scope', '$filter', '$modalInstance', 'certs', function ($scope, $filter, $modalInstance, certs) {