简体   繁体   English

分享这不起作用

[英]sharethis is not working

I am using Sharethis in my website 我在我的网站上使用Sharethis

here is the code which i have added 这是我添加的代码

<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "45bd003e-483d-41ec-9f43-b7c7bff3e9b1", doNotHash: false, doNotCopy: false, hashAddressBar: false, onhover:false});</script>

this is in my main html 这是在我的主要HTML

In current html i have this 在当前的HTML我有这个

<a class="st_sharethis_custom" st_title="{{profile.displayName}} Profile" st_image="{{profile.profileImage}}" ng-if="loggedIn"><span class="glyphicon glyphicon-share"></span><em>SHARE</em></a>

now the problem is when i goto that particular page the glyphicon is loading but on click on that sharethis is not working but if i refresh then it is working 现在的问题是,当我转到该特定页面时,glyphicon正在加载,但是在该共享上单击时这不起作用,但是如果我刷新则它正在起作用

means first time when i am loading the page it is not working but after one refresh it is working. 表示第一次加载页面时它不起作用,但是刷新后它正在起作用。

can someone help me in this thanks in advance 有人可以提前帮助我吗

add this js function 添加此js函数

$scope.initShare = function() {
        stButtons.locateElements();
    };

and add ng-init to the element 并将ng-init添加到元素

<a ng-init="initShare()" class="st_sharethis_custom"><img src="resources/scripts/lib/images/share.png" class="icons-s" ></a>

then it works... 然后就可以了...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM