0
votes

Trying to open and close a modal in an angualarjs application. I've finally got it open but now can not close it. I'm getting the unknown provider error. I thought I've injected ui.bootstrap correctly in my app. I'm just not sure what I'm doing wrong.

Using angular 1.6. My index file has the script of angularjs, ui-bootstrap.js and the ui-bootstrap-tpls scripts. If I take the uibModalInstance out everything runs fine modal opens but I have no way of closing it.

Here is my module:

var myApp = angular.module("myApp", ["ui.router", "ngAnimate", "angular-loading-bar","ui.grid","ui.grid.selection","ui.bootstrap", "common.services"])
.config(function ($stateProvider) {
//state config excluded
});

Here is the begining of my controller :

(function () {
"use strict";
angular
    .module("myApp")
    .controller("productListCtrl", productListCtrl);

productListCtrl.$inject = ["$filter", "$timeout", "$uibModal","$uibModalInstance", "productDataService"];

function productListCtrl($filter, $timeout, $uibModal, $uibModalInstance, productDataService) {
    var vm = this;

And here is the error

Error: [$injector:unpr] Unknown provider: $uibModalInstanceProvider <-    $uibModalInstance <- productListCtrl

http://errors.angularjs.org/1.6.2/$injector/unpr?p0=%24uibModalInstanceProvider%20%3C-%20%24uibModalInstance%20%3C-%20productListCtrl at http://localhost:54575/bower_components/angular/angular.js:68:12

1
update the post with your script referencesAravind
This would answer your question stackoverflow.com/a/37768522/87972Hoa

1 Answers

2
votes

remove ng-controller from your html if you written in html. It will solve your problem