0
votes

I have a button on click of that i have to open a popup. This is my configuration for opening modal :

var uibModalInstance = $uibModal.open({
              animation: true,
              ariaLabelledBy: 'modal-title',
              ariaDescribedBy: 'modal-body',
              controller: 'lsResultPopCtrl',
              templateUrl: 'template.html',
              windowTemplateUrl: 'template.html',
              size: size,
              resolve: {
                 items: function(){
                    return $scope.items;
                }
              }
            });

Controller code :

app.controller('lsResultPopCtrl', function ($scope, $uibModal, items) {

This code gives me error :

Error: [$injector:unpr] Unknown provider: itemsProvider <- items <- lsResultPopCtrl

I am following this example : https://angular-ui.github.io/bootstrap/

Edit :

In chrome debugger I can see items array in lsResultPopCtrl is loaded with the data, but pop up doesn't show up and i get the error.

1
What does your code look like? You need that in the question. It's clear that you aren't actually using the demo word for word (the example one doesn't use $scope for instance). - Matthew Green
Modal configurations are generated from a different function, so i included the final configuration object. - Naveen
can you make a plunker ? - svarog

1 Answers

0
votes

The dependency you should be injecting into your controller is $uibModalInstance, not $uibModal. Change that, and it will work:

app.controller('lsResultPopCtrl', ['$scope', '$uibModalInstance', 'items', function ($scope, $uibModalInstance, items) {
...
}]);