Hi guys,
I am trying and trying since hours to embed the widget properly. I have a @Input variable called twitterlink which is dynamically changing according to userinteraction. I am using it this way in my component.ts:
window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = “https://platform.twitter.com/widgets.js”;
fjs.parentNode.insertBefore(js, fjs);
t._e = [];
t.ready = function(f) {
t._e.push(f);
};
return t;
}(document, “script”, “twitter-wjs”));
My HTML:
<a *ngIf=“twitterLink” class=“twitter-timeline” data-lang=“en” href=“https://twitter.com/{{twitterLink}}”>Tweets by {{ twitterLink }}
but the widget renders only one time, I need to rerender it everytime the user clicks to retrieve Timeline data from another twitterprofile. And if I want to execute twttr.widgets.load() it says undefined.
Please guys, give a detailed example of how to do it, step by step, I dont understand why there isnt a more comprehensive documentation for Angular 5+, since Angular is very popular!
Best regards,
sagat