在angularjs Twitter的应用程序列表初始加载后不会呈现 [英] Twitter list in angularjs application does not render after initial load
问题描述
我有一个pretty标准NG-视图一个简单的应用程序angularjs如下:
I have a simple angularjs application with a pretty standard ng-view as follows:
<div id="myContent">
<div ng-view></div>
</div>
我的主页部分包含了Twitter的列表:
My home page partial contains a twitter list:
<div class="container">
<a class="twitter-timeline" width="1200" height='450' data-chrome="noheader nofooter noborders transparent"
data-tweet-limit="1" href="https://twitter.com/....."
data-widget-id="123.....">Tweets from
https://twitter.com/abc/def</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.async=true;
js.src = p + "://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);
}
}(document, "script", "twitter-wjs");</script>
</div>
这在第一次部分被访问时,Twitter的列表,几秒钟后呈现的伟大工程,但在随后返回到局部的微博列表不渲染,除非我刷新页面,并且只显示一个链接: https://twitter.com/abc/def
This works great on the first time the partial is accessed, the twitter list is rendered after a few seconds, but on subsequent returns to the partial the twitter list does not render unless I do a page refresh, and simply shows a link :Tweets from https://twitter.com/abc/def.
有没有办法,我可以调用Twitter的列表的刷新在我的控制器的方法吗?我可以将其添加到$超时调用一次呈现页面的窗口小部件,但我调用什么功能,使部件呈现?
Is there a way that I could invoke a refresh of the twitter list in my controller? I could add it to a $timeout to invoke the widget once the page is rendered, but what function do I invoke to make the widget render?
否则,我需要直接查询Twitter的API(我想避免的),并直接获得数据?
Else do I need to query the twitter api directly (which I would like to avoid), and get the data directly ?
推荐答案
这里有一个答案:<一href=\"http://stackoverflow.com/questions/22231350/why-will-my-twitter-widget-not-render-if-i-change-the-view-in-angularjs\">Why会,如果我改变angularjs认为我的Twitter小部件不呈现,并在这里:的 https://twittercommunity.com/t/cannot-update-tweet-button-with-ajax/16989/2
There is an answer here: Why will my twitter widget not render if i change the view in angularjs? and here: https://twittercommunity.com/t/cannot-update-tweet-button-with-ajax/16989/2
只是为了更容易地看到,这个问题被解决(
Just to make it easier to see that this problem is solved (:
这篇关于在angularjs Twitter的应用程序列表初始加载后不会呈现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!