AngularJs and AddThis social plugin

后端 未结 6 1676
时光说笑
时光说笑 2020-12-10 06:37

I\'m trying to use the AddThis javascript Social plugin in an AngularJS App, but It does not updates the addthis plugin icons when I load a partial with ng-view. If I refres

6条回答
  •  -上瘾入骨i
    2020-12-10 07:22

    If you are using the new AddThis dashboard configuration then you can just wrap addthis.layers.refresh() (see: http://www.addthis.com/academy/using-dashboard-configuration-tools-dynamically/) in a directive and add to your div.

    .directive('addthisToolbox', function() {
        return {
            restrict: 'A',
            transclude: true,
            replace: true,
            template: '
    ', link: function ($scope, element, attrs) { // Checks if addthis is loaded yet (initial page load) if (addthis.layers.refresh) { addthis.layers.refresh(); } } }; });

    HTML:

提交回复
热议问题