0
我想縮小我的app.js代碼(嘗試了幾個在線工具)。但是我得到了問題中提到的錯誤。這是我的代碼:錯誤:意外的令牌punc«)»,期望punc«,»同時縮小angularjs應用
(function() {
var app = angular.module('LazyApp', []);
app.directive('lazyLoad', ['$window', function($window) {
return {
restrict: 'A',
scope : {},
link: function(scope, element, attrs) {
var images = Array.prototype.slice.call(element[0].querySelectorAll("img[data-src]"));
var videos = Array.prototype.slice.call(element[0].querySelectorAll("iframe[data-src]"));
}
}
})
}])();
我在做什麼錯?
'['之前,你的功能標籤是問題.. –
@KishoreSahas不完全,但括號和方括號絕對看起來不匹配 – Phil
我剛剛意識到我沒有添加'$窗口'就在我的功能之前。 –