compact / angular-bootstrap-lightbox

An AngularJS lightbox built using UI Bootstrap Modal.
http://compact.github.io/angular-bootstrap-lightbox/
MIT License
306 stars 134 forks source link

Unknown provider: LightboxProvider <- Lightbox #56

Open vsrboth opened 8 years ago

vsrboth commented 8 years ago

I am trying to use this with ionic project, but I keep having this kind of bug:

ionic.bundle.js:21157 Error: [$injector:unpr] Unknown provider: LightboxProvider <- Lightbox <- propertyDamageController
http://errors.angularjs.org/1.4.3/$injector/unpr?p0=LightboxProvider%20%3C-%20Lightbox%20%3C-%20propertyDamageController
    at ionic.bundle.js:8895
    at ionic.bundle.js:13089
    at Object.getService [as get] (ionic.bundle.js:13236)
    at ionic.bundle.js:13094
    at getService (ionic.bundle.js:13236)
    at invoke (ionic.bundle.js:13268)
    at Object.instantiate (ionic.bundle.js:13285)
    at ionic.bundle.js:17841
    at self.appendViewElement (ionic.bundle.js:52255)
    at Object.switcher.render (ionic.bundle.js:50449)

Here is what I inject into my ionic app:

angular.module('starter', ['ionic', 'ionic-material', 'ionic-toast', 'ngCordova','starter.model', 'starter.factory', 'ui.router','ngPDFViewer','ui.bootstrap', 'bootstrapLightbox'])

function propertyDamageController($scope, $state, $cordovaCamera, vehicle, Lightbox) {
compact commented 8 years ago

How did you install the package?

jemliF commented 8 years ago

i got the same error, i installed the package using bower

abhith commented 8 years ago

minification issue may be (your app.js).

if array of images configured via this,

angular.module('app').config(function (LightboxProvider) {
  LightboxProvider.getImageUrl = function (image) {
    return '/base/dir/' + image.getName();
  };

  LightboxProvider.getImageCaption = function (image) {
    return image.label;
  };
});

Change it to,

angular.module('app').config(['LightboxProvider', function (LightboxProvider) {
   LightboxProvider.getImageUrl = function (image) {
    return '/base/dir/' + image.getName();
  };

  LightboxProvider.getImageCaption = function (image) {
    return image.label;
  };
}]);
twilly86 commented 8 years ago

Also getting this issue, minification is not the problem. Maybe a conflict of version with angular boostrap lib?

pitometsyurii commented 7 years ago

I have the same issue. How to resolve it?

farhaan008 commented 7 years ago

I have also the same issue, getting this error. Error: [$injector:unpr] Unknown provider: $uibModalProvider <- $uibModal <- Lightbox <- Lightbox

anybody knows solution