[英]Angular ui bootstrap modal passing multiple parameters
I am using an angular ui bootstrap modal for one of my applications. 我正在为我的一个应用程序使用角度ui bootstrap模式。 Currently i am calling the modal instance using the following:
目前我使用以下方法调用模态实例:
<button class="btn btn-default btn-sm pull-right"
ng-click="open({{node.id}})">Add Course <span class="glyphicon glyphicon-plus">
</span>
</button>
I have defined the modal as follows: 我已经将模态定义如下:
$scope.open = function (node) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
detail: function() {
return node;
}
}
});
};
Here the open()
function passes the id of the node. 这里
open()
函数传递节点的id。 Here node is a django item which has details like id, required etc.. 这里的节点是一个django项目,其中包含id,required等详细信息。
My modal instance is defined as follows: 我的模态实例定义如下:
var ModalInstanceCtrl = function ($scope, $http, $log, $modalInstance, detail) {
$scope.subcategory = detail;
};
So far the modal works fine and i am able to pass the node.id to the modal. 到目前为止,模态工作正常,我能够将node.id传递给模态。 But now i want to pass even the other parameters within the node like
open({{node.required}}, {{node.id}})
etc to the modal. 但是现在我想将节点中的其他参数
open({{node.required}}, {{node.id}})
例如open({{node.required}}, {{node.id}})
等传递给模态。 How do i modify my modal open()
and modalinstance()
functions to receive multiplt parameters? 如何修改我的模态
open()
和modalinstance()
函数以接收multiplt参数?
You can add more objects to the resolve section: 您可以向resolve部分添加更多对象:
$scope.open = function (node, node2) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
detail: function() {
return node;
},
detail2: function() {
return node2;
}
}
});
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.