1
我使用Angular來循環訪問數組中的一串推特ID,並將它們呈現到由Twitter嵌入代碼包圍的頁面。問題是變量正在更新,但嵌入的twitter沒有被刷新。這裏是什麼樣子:角度變量更新,但不刷新周圍的鳴叫嵌入代碼
HTML:
<!--output the variable for testing (works fine)-->
{{tweets[index].twitterID}}
<!--twitter embed code wrapped around the above variable -->
<blockquote class="twitter-tweet" width="500" align="center" lang="en">
<a ng-href="https://twitter.com/user/statuses/{{tweets[index].twitterID}}"></a>
<script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script>
</blockquote>
<!--button to cycle to next tweet-->
<div id="btn" ng-click="increment()">Next</div>
腳本:
$scope.tweets = [] //my tweets json object
$scope.index = 0;
$scope.increment = function() {
$scope.index = $scope.index + 1;
}
第一鳴叫被嵌入罰款,而下一個按鈕的功能更新變量,鳴叫嵌入ISN」不變。有人知道爲什麼