facebook - angularjs fb like don't render value -
i've strange behavior code
.controller('contestantcreatectrl',function($scope,config) { $scope.shareurl = 'https:'+config.site.absoluteurl+'/'; }) .directive('btfbparse', function () { return { restrict:'a', link:function (scope, element, attrs) { console.log(scope.shareurl);//it works if(scope.facebookisready){ fb.xfbml.parse(); } } }; }) if in view set
<div class="fb-like" data-href="https://my-dev.me/public/" data-width="120" data-colorscheme="light" data-layout="standard" data-action="like" data-show-faces="true" data-send="false"></div> <div bt-fb-parse></div> it works
but if in view set up
<div class="fb-like" data-href="{{shareurl}}" data-width="120" data-colorscheme="light" data-layout="standard" data-action="like" data-show-faces="true" data-send="false"></div> <div bt-fb-parse></div> i form facebook api "/plugins/error/api?code=100&message=the+href+url+must+be+absolute&hash=aqdvwdudsg3_avqh
i tried with
scope.$apply() in directive fb works angular show me error: $digest in progress
i don't know way turn ....
update
with
_.defer(function(){ scope.$apply(); fb.xfbml.parse(); }); it works :)
Comments
Post a Comment