Reputation: 3340
I'm using Brian Ford's angular-modal library to provide modals for my app. It works properly in development, but minification seems to break it even though I'm using ngmin through a gulp build process.
Error: [$injector:unpr] Unknown provider: tProvider <- t <- btfModal <- deleteConfirmationModal
http://errors.angularjs.org/1.2.17-build.225+sha.9227a5d/$injector/unpr?p0=tProvider%20%3C-%20t%20%3C-%20btfModal%20%3C-NaNeleteConfirmationModal
at http://localhost:3005/live/vendors.min.js:1:697
at http://localhost:3005/live/vendors.min.js:1:17123
at Object.n [as get] (http://localhost:3005/live/vendors.min.js:1:16388)
at http://localhost:3005/live/vendors.min.js:1:17218
at n (http://localhost:3005/live/vendors.min.js:1:16388)
at Object.r [as invoke] (http://localhost:3005/live/vendors.min.js:1:16673)
at http://localhost:3005/live/vendors.min.js:1:17236
at n (http://localhost:3005/live/vendors.min.js:1:16388)
at Object.r [as invoke] (http://localhost:3005/live/vendors.min.js:1:16673)
at http://localhost:3005/live/vendors.min.js:1:17236
Based on what I've read in general about Unknown provider
errors, I'm sure it’s a problem with dependency injection. I've tried every permutation I can think of, but I can't make it work.
Here's the pertinent code:
Creates the module:
angular.module('gridsmartWebClient.modal', ['btford.modal']);
Factory:
angular.
module('gridsmartWebClient.modal')
.factory('deleteConfirmationModal', function (btfModal) {
'use strict';
return btfModal({
controller: 'DeleteModalCtrl',
controllerAs: 'modal',
templateUrl: '/gridsmart-web-client/camera/delete-confirmation.html'
});
})
Factory after ngmin:
angular.module('gridsmartWebClient.modal').factory('deleteConfirmationModal', [
'btfModal',
function (btfModal) {
'use strict';
return btfModal({
controller: 'DeleteModalCtrl',
controllerAs: 'modal',
templateUrl: '/gridsmart-web-client/camera/delete-confirmation.html'
});
}
])
App dependencies:
angular.module('gridsmartWebClient', [
'ngRoute',
'gridsmartWebClient.grid',
'gridsmartWebClient.camera',
'gridsmartWebClient.modal',
'gridsmartWebClient.utils',
'dropdownDirective',
'btford.modal',
'gridsmart-web-client-templates'
])
So, despite the fact I know there's a problem with dependency injections, I can't see what it would be. The module the factory is declared in has been injected in the app. I've looked through other responses to similar questions but answers are either very specific to the respective scenarios or general so as not to be especially useful to me. (e.g. "It's a dependency problem."). What gives?
Upvotes: 0
Views: 228
Reputation: 8976
The problem is in vendors.min.js, not your code. You need ngmin all your vendor scripts as well.
Upvotes: 1