Nesting tweets inside angular ng-view

I want to use inline tweets inside partial ng view, but for some reason it doesn't work. if I put it outside of the partial (directly in index.html), it works. Anyone have an idea how to fix this?

+5
source share
2 answers

The problem is that the tweeter script and your main.html are loaded: when mail.html is loaded before widget.js, the tweeter script cannot find your element backquoteand make it a nice way.

You can put <script ...>in main.html, but in this case keep in mind that Angular jqLite does not support tags <script>in partial files uploaded via XHR. So you need to enable real jQuery before angular.

Here is the plunker: http://plnkr.co/edit/rQUThnZNAyJQGFIwflGk?p=preview

+5
source

This means that we need to call js twitter again - this is not related to Angularjs in a specific way. Since a partial view of Angular js is not immediately displayed, a problem occurs. The solution is to call the js file again after loading the part:

$timeout(function() {
    $.ajax({ url: 'http://platform.twitter.com/widgets.js', dataType: 'script', cache:true});
}, 1000);

see: Repeat Tweet button via JS

+4
source

All Articles