【发布时间】:2019-12-30 21:52:08
【问题描述】:
我正在尝试将 Google Adsense 广告放入 Angularjs ng-repeat 中,如下所示。但它不起作用
<div ng-repeat="item in items"
<div ng-include src="view.getItem($index)"></div>
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<div ng-if="$index == 0" google-adsense>
<ins class="adsbygoogle responsive"
style="display:inline-block;width:468px;height:60px"
data-ad-client="ca-pub-"
data-ad-slot=""></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
</div>
</div>
我在控制台中看到以下错误。
Uncaught Error: adsbygoogle.push(): All ins elements in the DOM with class=adsbygoogle already have ads in them
有没有办法在 ng-repeat 中显示 adsense 广告?
【问题讨论】:
-
为什么要多次添加同一个脚本
标签: angularjs angularjs-ng-repeat adsense