मैं एक कोणीय जेएस एप्लीकेशन विकसित कर रहा हूं जो एक दृश्य में एफबी-जैसे एकीकृत करता है। यह केवल पहली बार काम करता है और यदि मैं ब्राउज़र को भी रीफ्रेश करता हूं, जब मैं अन्य दृश्य पर नेविगेट करता हूं और वापसी करता हूं तो प्लगइन काम नहीं करता है।कोणीयजेएस + फेसबुक जैसे निर्देश काम नहीं कर रहे हैं
मैंने एक निर्देश बनाया है।
angular.module('myApp.directives', []).directive('fbLike',['$timeout', function($timeout) {
return {
restrict: 'A',
scope: {},
template: "<div class=\"fb-like-box\" data-href=\"{{page}}\" data-width=\"{{width}}\" data-show-faces=\"{{faces}}\" data-height=\"{{height}}\" data-show-border=\"{{border}}\" data-stream=\"{{stream}}\" data-header=\"{{header}}\"></div>",
link: function($scope, $element, $attrs) {
var working, _ref, _ref1;
$scope.page ="https://www.facebook.com/company_name";
$scope.border = false;
$scope.height = (_ref = $attrs.fbHeight) != null ? _ref : '260';
$scope.faces = $attrs.fbFaces != null ? $attrs.fbFaces : 'false';
$scope.stream = $attrs.fbStream != null ? $attrs.fbStream : 'true';
$scope.header = $attrs.fbHeader != null ? $attrs.fbHeader : 'false';
$scope.width = (_ref1 = $attrs.fbWidth) != null ? _ref1 : $element.parent().width()-19;
$timeout(function() { return typeof FB !== "undefined" && FB !== null ? FB.XFBML.parse($element.parent()[0]): void 0; });
}
};}]);
मेरा विचार
<script>
window.fbAsyncInit = function() {
FB.init({
appId: '',
status: true, // check login status
cookie: true, // enable cookies to allow the server to access the session
xfbml: true, // parse XFBML
oauth: true
});
};
(function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0];
if (d.getElementById(id)) return;
js = d.createElement(s); js.id = id;
js.src = "//connect.facebook.net/es_LA/all.js#xfbml=1";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
<div fb-like></div>
मैं दूसरा विकल्प है, लेकिन कोई भाग्यशाली लिए देख रहा था।
मुझे नहीं पता कि क्या गलत है।
बहुत बहुत शुक्रिया
पर एक डेमो आप कभी भी यह पता लगा था नहीं है? मुझे एक ही समस्या है – rob
@rob हैलो, हाँ, मैंने फेसबुक यूआई का उपयोग करने की प्राथमिकता दी है। इसलिए मैं ऐप में कोणीय-easyfb.js मॉड्यूल शामिल करता हूं। तो फिर तुम डाल अपने तरह इंटरफ़ेस
में btn आशा है कि यह आप – schwertfisch