0

I have Google ads Javascript code in database. I am fetching the data as JSON type. When I am displaying these ads in my partial page, it's displaying just code - not the actual ad.

I tried to add a directive with $compile(element)(scope) and $sce.trustAsJs(element), but no luck.

E.g. <script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> This code is in my DB as ads.

And I am displaying like this {{ google_ads }}.

I also tried

PG1
  • 1,220
  • 2
  • 12
  • 27

0 Answers0