我非常想嘗試使我的第一個網頁初學者。我正在使用帶角度路線的角度。每個入門文檔包含所需photoswipe html的頁面被注入index.html。我得到以下錯誤。 「未捕獲類型錯誤:無法讀取屬性‘則firstChild’的未定義」,其指向行photoswipe.js的66(VAR節點= ....)Photoswipe with angularJS pswp undefined
getChildByClass: function(parentEl, childClassName) {
var node = parentEl.firstChild;
while(node) {
if(framework.hasClass(node, childClassName)) {
return node;
}
node = node.nextSibling;
}
通過我結束與非常的代碼之後parentEL向上根據入門文檔再次提供所需js的第一行。
var pswpElement = document.querySelectorAll('.pswp')[0];
添加console.log(pswpElement)返回undefined,我認爲這是根本問題。該文件說,class = pswp必須是photoswipe的根元素的類。它在我的路由定義中爲/ gallery注入的html頁面的根元素中。我也嘗試將它添加到每個元素,包括在我的index.html頁面中包含ng-view的div。 pswpElement總是回到未定義狀態。
任何幫助集成photoswipe與角度將不勝感激。