I am using an angular ui bootstrap modal for one of my applications. 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. Here node is a django item which has details like id, required etc..
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. But now i want to pass even the other parameters within the node like open({{node.required}}, {{node.id}})
etc to the modal.
How do i modify my modal open()
and modalinstance()
functions to receive multiplt parameters?
You can add more objects to the resolve section:
$scope.open = function (node, node2) {
var modalInstance = $modal.open({
templateUrl: 'myModalContent.html',
controller: ModalInstanceCtrl,
resolve: {
detail: function() {
return node;
},
detail2: function() {
return node2;
}
}
});
};
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With