2017-08-09 43 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來複制錯誤。 –

相關問題