Angular ui bootstrap modal passing a few parameters

I am using angular ui bootstrap modal for one of my applications. I am currently invoking a 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 defined the modality as follows:

$scope.open = function (node) {
    var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,
        resolve: {
            detail: function() {
                return node;
            }
        }   
    });
};

Here the function open()passes the identifier node. Here node is a django element that has data such as id, required, etc.

My modal instance is defined as follows:

var ModalInstanceCtrl = function ($scope, $http, $log, $modalInstance, detail) {
    $scope.subcategory = detail;
};

While modal works fine, and I can pass node.id to modal. But now I want to pass even other parameters to node, for example open({{node.required}}, {{node.id}}), etc. For modal. How to change my modal functions open()and modalinstance()to get multiplet parameters?

+4
1

:

$scope.open = function (node, node2) {
    var modalInstance = $modal.open({
        templateUrl: 'myModalContent.html',
        controller: ModalInstanceCtrl,
        resolve: {
            detail: function() {
                return node;
            },
            detail2: function() {
                return node2;
            }
        }   
    });
};
+18

Source: https://habr.com/ru/post/1541308/


All Articles