Amin
Amin

Reputation: 1302

Second controller for Modal Instance of Angular Bootstrap UI

I want to define second template and controller for modal dialogue in Angular bootstrap UI. But system return an error [$injector:unpr] Unknown provider: itemsProvider <- items <- newCtrl

http://embed.plnkr.co/lox1ZkU516NRL445v9el/preview

Any one has idea about what this happens?

Upvotes: 1

Views: 61

Answers (1)

Hari Pachuveetil
Hari Pachuveetil

Reputation: 10374

You have a typo in the object you're trying to resolve with - instead of item it should be items. The below function works (fixed Plunker):

$scope.openNew = function(size){
  var xmodal = $modal.open(
    {
     templateUrl: 'myModalContent.html',
     controller: 'newCtrl',
     resolve:{items: function(){return $scope.items;}}

    });

}

Upvotes: 3

Related Questions