Twitter widget in angularjs website repeats more than once

javascript

#1

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!


#2

Unfortunately we had a short-term issue where some widgets were being repeated on some sites. Hopefully the change we’ve just made should be returning things to normal.


#3

Got it. Thanks for the quick action.


#4