I have a directive for twitter widget for my angularjs website.
<a class="twitter" href="[My-twitter-url]" data-widget-id="[My-ID]">Tweets</a>
<script>!function(d,s,id){
var js,
fjs=d.getElementsByTagName(s)[0],
p=/^http:/.test(d.location)?'http':'https';
if(!d.getElementById(id)){
js=d.createElement(s);js.id=id;
js.src=p+"://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js,fjs);
}
}(document,"script","twitter-wjs");
</script>
When I use this directive in my views it gets displayed more than once. I am not sure why this is happening. Is this something to do with the digest cycle? How to fix this? Thanks!