我正在使用ui.bootstrap
开发一个简单的模态窗口。当我们点击某个按钮绑定到控制器并启动时会显示此模态,但是模态及其内容绑定到另一个控制器,因此当我们需要点击以了解控制器所在的位置时该项目的另一个文件夹。
例如,对结构进行如下成像:
COMPONENT1
..... template1.html
..... controller1.js
COMPONENT2
..... template2.html
..... controller2.js
controller1.js
负责加载模态视图,该模式视图分别呈现template2.html
和controller2.js
并与controller1.js
和 $scope.open = function (size) {
var modalInstance = $uibModal.open({
templateUrl: 'components/component2/template2.html',
controller: 'components/component2/controller2.js',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
modalInstance.result.then(function (selectedItem) {
$scope.selected = selectedItem;
$log.debug(selectedItem);
}, function () {
$log.info('Modal dismissed at: ' + new Date());
});
};
绑定。所以,在controller2.js
我们有这个:
templateUrl
这对$uibModal.open
显然不起作用。正如我们所做的那样'Error using vl_impattern'
,有没有办法加载控制器将其路径作为SELECT t1.cd_art, t1.ct, t2.an_ct, t2.an2_ct
FROM (SELECT cd_art, sum(ct) as ct FROM table1 GROUP BY cd_art) t1
INNER JOIN (SELECT cd_art, sum(an_ct) as an_ct, sum(an2_ct) as an2_ct
FROM table2 GROUP BY cd_art) t2 ON t2.cd_art = t1.cd_art;
中的参数传递?
答案 0 :(得分:1)
我没有测试过,但做了类似的事情:
var modalInstance = $uibModal.open({
templateUrl: 'components/component2/template2.html',
controller: 'ModalController',
size: size,
resolve: {
items: function () {
return $scope.items;
}
}
});
app.controller('ModalController', function ($scope, $modalInstance) {
// do some things
});