【发布时间】:2021-10-05 22:29:10
【问题描述】:
我正在关注https://help.twitter.com/en/using-twitter/embed-twitter-feed 在角度页面中嵌入时间线。只有按钮呈现,而不是实际的时间线。
index.html 看起来像:
<body style="margin:0">
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
<app-root></app-root>
</body>
app.component.html 如下所示:
<a class="twitter-timeline"
href="https://twitter.com/TwitterDev/lists/national-parks?ref_src=twsrc%5Etfw">
A Twitter List by TwitterDev
</a>
还尝试了 app.component.ts 之类的东西:
ngOnInit(){
if ((<any>window).twttr.ready())
(<any>window).twttr.widgets.load();
}
但没有运气
【问题讨论】:
-
放在 index.html 里面就可以了?
-
是的,它确实可以放在 index.html 上
-
刚刚在 stackblitz 中尝试过,它似乎可以正常工作stackblitz.com/edit/angular-2mbweb
-
是的,你的代码可以在 stackblitz 中工作,但对我来说却不行。只有当我把它放在 index.html 上时它才有效。但不在 app.components.html
-
@MoblizeIT 你的浏览器控制台有错误吗?
标签: node.js angular typescript ecmascript-6 single-page-application