0

我已经为 addthis 插件创建了这个指令,但它只偶尔显示/渲染按钮,而不是每次......

.directive('addThis', function(){
return {
    restrict: 'A',
    scope: {
        image: '='
    },
    replace: true,

    templateUrl: Directory.url + '/templates/_addthis.html',
    link: function(scope, elm){
        console.log('Create addthis button');
    }   
}

})

模板代码:

<ul class="image-actions">
<li><a class="addthis_button_facebook" addthis:url="{{image.link}}" fb:like:href="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a></li>
<li><a class="addthis_button_twitter" tw:url="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a></li>
<li><a class="addthis_button_pinterest_share" addthis:url="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a></li>
<li><a class="addthis_button_google_plusone_share" addthis:url="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a></li>
<li>
    <a class="addthis_button_compact" addthis:url="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a>
    <a class="addthis_counter addthis_bubble_style" addthis:url="{{image.link}}"  addthis:title="{{image.post.post_title}}"></a>
</li>

感谢您的帮助...我希望能够控制它何时呈现...或以某种方式将其注入范围...?

4

0 回答 0