我正在Angular JS的帮助下开发一个小型网站。我在页面上放置了两个Google广告,另一个放在右侧边栏上。这是我的网页http://sarathiblog.com/particle/particle-photon-intro的链接。
我已创建了一个自定义指令,可将广告放在我的网页上
.directive('googleAdsenseSide', function () {
return {
restrict: 'EA',
replace: true,
template:'<ins class="adsbygoogle" style="display:block; max-width:336px; max-height:280px" data-ad-client="ca-pub-XXXX" data-ad-slot="XXXX" data-ad-format="auto"></ins>',
controller: function () {
//console.log("sarathiblog: Google Adsense is being added!");
(adsbygoogle = window.adsbygoogle || []).push({});
}
};
});
我使用<google-adsense-side>
标记来包含该指令。当我尝试将style="position:fixed"
应用于包含上述标记的div时。
<div style="position: fixed">
<google-adsense-side></google-adsense-side></div>
检查控制台时出现以下错误。
angular.js:14525
. T
. message
:
"adsbygoogle.push() error: No slot size for availableWidth=80"
name
:
"TagError"
stack
:
"TagError: adsbygoogle.push() error: No slot size for availableWidth=80↵ at se (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:28573)↵ at He (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:33384)↵ at If (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:52831)↵ at Gf (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:49334)↵ at Hf (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:49304)↵ at Sf (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:57455)↵ at Tf.c.client (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:55741)↵ at nc (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:11657)↵ at wc (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:14349)↵ at Object.Tf [as push] (http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js:1:55720)"
__proto__
:
Error
“”