2017-08-09 33 views
0

我一直在这工作了大约5个小时,我不知道我在做什么错。该代码是从http://compact.github.io/angular-bootstrap-lightbox/demo6/复制我是新角度和卡住。angularjs - 玩弄angular-bootstrap-lightbox和它给我一个类型错误

这是我在我的控制器:

'use strict'; 

angular.module('portfolio.photography',[ 
    'bootstrapLightbox', 
    'ngRoute' 
]) 
.config(['$routeProvider', function($routeProvider) { 
    $routeProvider.when('/photography', { 
     templateUrl: 'photography/photography.html', 
     controller: 'PhotographyCtrl' 
    }); 
}]) 
.controller('PhotographyCtrl',[ 
    '$scope', function($scope, Lightbox) { 
    $scope.openLightboxModal = function (index) { 
     Lightbox.openModal($scope.images, index); 
    }; 
}]) 

这个错误,我得到:

angular.js:14199类型错误:无法读取未定义

回答

0

你的财产 'openModal'小姐在支架内添加Ligthbox注射剂

['$scope', 'Lightbox', function($scope, Lightbox){}] 

更新 我做了一个plnkr与所有依赖需要工作的基础上,我认为你需要包括ui-bootstrap依赖。检查了这一点

example

+0

我已经试过了也和我的整个网页一片空白,我得到这个错误---错误:[$注射器:unpr]未知提供商:$ uibModalProvider < - $ uibModal < - 灯箱< - 灯箱 –

+0

可能具有ui-bootstrap依赖性。 –

+0

你能否提供一个plnkr来复制错误。 –

相关问题