【问题标题】:fb comments href not working whith angularjsfb评论href不适用于angularjs
【发布时间】:2014-04-09 18:20:25
【问题描述】:

我已经在我的页面上安装了下面的 FB 插件,其中我指定了 data-href 如下:

<div class="fb-comments"  data-href="http://pingle.com/ngdemo" data-width="550px" data-numposts="5" data-colorscheme="light"></div>

但是,当我尝试为其设置范围值以使 URL 具有特定性时,它没有采用它,并且在检查 firefox 时,值 {{ post.id }} 没有被添加到 fb DIV 中的 URL。

    <div class="fb-comments"  data-href="http://pingle.com/ngdemo?postId={{ post.id }}" data-width="550px" data-numposts="5" data-colorscheme="light"></div>

PS:当我在 html 上打印时,就在 fb 插件上方,它显示得很好吗?有没有办法将范围值附加到 fb 评论的 data-href 属性??

【问题讨论】:

    标签: facebook angularjs angularjs-scope facebook-comments angular-ui-bootstrap


    【解决方案1】:

    像这样尝试ng-attr-*

    <div class="fb-comments"  ng-attr-data-href="http://pingle.com/ngdemo?postId={{ post.id }}" data-width="550px" data-numposts="5" data-colorscheme="light"></div>
    

    【讨论】:

    • 我按照你说的尝试了,即在控制器中我添加了:$scope.commentURL = 'pingle.com/ngdemo?postId='+post.id;并在 UI "
      “但它不起作用。我检查了 firebox 控制台,它似乎将其视为空并默认采用当前页面 URL
    • 我希望,现在应该可以了。参考 - docs.angularjs.org/guide/…
    • 如果我将 ng-attr 添加到 fb 插件的 data-href 中,插件本身不会出现!
    猜你喜欢
    • 2012-08-09
    • 2021-03-04
    • 2016-03-04
    • 1970-01-01
    • 1970-01-01
    • 2013-02-04
    • 2012-02-04
    • 2012-03-12
    • 1970-01-01
    相关资源
    最近更新 更多