运行Twitter和Facebook分享按钮code的ListCtrl更新后 [英] Run Twitter and Facebook Share Button Code After ListCtrl Update

查看:159
本文介绍了运行Twitter和Facebook分享按钮code的ListCtrl更新后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要建一个网站,我需要像/共享按钮和列表中的几个元素的微博分享按钮显示的Facebook。基本上我有正在使用的角度控制器和NG-重复异步加载事件的列表。

I'm building a website where I need to display Facebook like/ share buttons and a twitter share button on several elements in a list. Basically I have a list of events that are loaded asynchronously using an an angular controller and ng-repeat.

我遇到的问题是,Twitter和Facebook按钮现在需要一个js小部件和一些JS code需要执行,使显示的按钮。这将是罚款,如果该事件被渲染的服务器端,但他们不是这样做的采用了棱角分明的,我需要有事件被渲染后执行的JS code。

The problem I am encountering is that twitter and Facebook buttons require a js widget now and some js code needs to be executed to make the buttons display. This would be fine if the events were rendered server side, but they are instead done so using angular, and I need to have that js code executed after the events are rendered.

从本质上讲,我的问题是:我怎么能运行一些$ C $每次C时NG-重复在角后呈现

Essentially, my question is: how could I run some code each time after an ng-repeat is rendered in angular?

谢谢你们

推荐答案

解决了这个使用的指令,基本上只是添加到了我的javascript:

Solved this using directives, basically just added this to my javascript:

myApp.directive('afterEventsLoadedDirective', function() {
    return function(scope, element, attrs) {
        if (scope.$last){
            // handle events here
        }
    };
});

这篇关于运行Twitter和Facebook分享按钮code的ListCtrl更新后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆