Excuse my ignorance here, I'm fairly new to NG and this may be an easier
issue to fix than I'm making it, but it's really got me stumped.
A little background here for reference, I'm building a page that can
infinite scroll. Interspersed throughout the content will be DFP ads
(Double Click for Publishers) that are javascript based. The issue I'm
having is this, I can get the javascript to fire, but I can't pass any
variables into it. For this specific need I have to have the ability to
create unique names so the ads can target the correct div to load into. I'm
doing this by incrementing through a var 'adSlot1, adSlot2, adSlot3, etc'
which is the name of the div id - which works. My big hangup is passing the
variable into the js script tage. I'll past my code below, it's pretty
straight forward, and it might make better sense than me trying to describe
it. I've tried trustAsJS and I've looked into the $sce service, but there's
not a lot of documentation out there, so I may be implementing it
incorrectly? A big thank you in advance for any help you might be able to
lend me.
*home.html*
<div data-medium-rectangle *data-inc=*'*{{brick.inc}}*'></div>
*app.js*
hr.directive('mediumRectangle', function() {
return {
transclude:true,
replace:true,
scope:{
*inc*: '@'
},
templateUrl: 'ads/medium-rectangle.php'
}
});
*medium-rectangle.php*
<div style="width:300px; height:250px;" id="adSlot*{{inc}}*">
<script>
var slotName = adSlot*{{inc}}*;
googletag.cmd.push(function() {
var slot = googletag.defineSlot("/3244/dfp/id/", [300, 250], slotName)
.setTargeting("pos","1")
.addService(googletag.pubads());
googletag.display(slotName);
googletag.pubads().refresh([slot]);
});
</script>
</div>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.