I've been trying to prevent adsense ads from loading in angular using the following code:
<div class="" ng-if="window.location.host.indexOf('localhost') < 0">
ads here
</div>
While the script works fine and logs okay in the console during testing, it doesn't seem to work when live. I'm guessing this could be because of the delay between the check being executed and the host resolving. Would it be better to use something like this instead?
<div class="" ng-if="$location.host().indexOf('localhost') < 0">
ads here
</div>
Any insights would be greatly appreciated!