Kåre Rasmussen
Kåre Rasmussen

Reputation: 913

cant inject $modal in angular module

Im bulding an AngularJS app. as part of this app, I need a modal popup. I got this working in plunker: http://plnkr.co/edit/FtH8hkuaEj5A2zhMJdnE?p=preview But when I try to implement it into the actual app, I get an error when injecting the $modal in any module.

http://errors.angularjs.org/1.5.7/$injector/unpr?p0=%24modalProvider%20%3C-%20%24modal%20%3C-%20webpartnerController

I have angular v1.5.7 angular-ui/ui-bootstrap v2.3.1

Module:

var app = angular.module("webpartner", [
    "ui.router", "" +
    "angularSpinner",
    "ngMaterial",
    "material.svgAssetsCache",
    "ngMessages",
    "firebase",
    "angularMoment",
    "ngAnimate",
    "ui.bootstrap"
]);



(function () {
    "use strict";
    angular.module("webpartner")
        .controller("webpartnerController",
            function webpartnerController($modal) {
                var vm = this;
            }
        );
})();

Upvotes: 1

Views: 660

Answers (1)

cnorthfield
cnorthfield

Reputation: 3501

The version of ui bootstrap in that plunker is an older version and uses $modal.

It should be $uibModal with the version that you are using.

Here's the documentation for the version that you are using http://angular-ui.github.io/bootstrap/#/modal

...and a plunker taken from the documentation https://plnkr.co/edit/?p=preview

Upvotes: 1

Related Questions