Comments (6)
Did you load FB JS SDK yourself by adding this: (which is from the official doc)
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v2.4'
});
};
(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/en_US/sdk.js";
fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>
to the web page?
angular-easyfb
wraps the SDK loading process into it, so there's no need to load the SDK by yourself. And you can access the SDK loading function with getLoadSDKFunction / setLoadSDKFunction.
from angular-easyfb.
No I didn't... But now that you say it, it is possible that the SDK is already loaded in the project. I am using this in a Meteor project, that includes a package for facebook login, so I think that package might be loading the SDK before ezfb does it...
Thing is, if I don't call the init on ezfb, I can't use the ezfb like button directive, right? (or it is not a directive?).
Now I have more doubts than before 😅
from angular-easyfb.
So it seems that is the problem. Somewhere, at some point (I couldn't figure out where or how), the SDK is already loaded in my project. And the FB.Init function called.
What I did is simply set the initfunction like this:
var myInitFunction = ['$window', '$rootScope', 'ezfbInitParams', function ($window, $rootScope, ezfbInitParams) {
//$window.FB.init(ezfbInitParams);
$rootScope.$broadcast('FB.init');
}];
ezfbProvider.setInitFunction(myInitFunction);
Commenting out the initialization line. And that way seems to work, no warning, the like button is loading ok... I hope everything else also works!
Anyways this is not a problem from the plugin, so I am closing this. Thanks for everthing @pc035860 !!
from angular-easyfb.
Oh and I also used:
// Feasible config if the FB JS SDK script is already loaded
ezfbProvider.setLoadSDKFunction(['ezfbAsyncInit', function (ezfbAsyncInit) {
ezfbAsyncInit();
}]);
For avoid loading the sdk twice. Just leaving this written down here, in the unlikely case someone has the same exact problem 😆
from angular-easyfb.
I actually forgot that one was in README 😑
Thank you! 👍
from angular-easyfb.
Nah, it didn't work. I do need to load the sdk twice. ezfb is trying to initialize stuff before the "other thing" loads the SDK. I tried to make it wait until the SDK is loaded, but then after waiting for it, the angular templates are already parsed, and the "like" button doesn't show.
I'll go with this until I have time to do something else. Thanks again for the plugin!
from angular-easyfb.
Related Issues (20)
- Facebook Comment And Like Track HOT 9
- Page Plugin not loading on iPad Safari iOS 9.2.1 HOT 1
- "Main" field in package.json is wrong HOT 2
- Upload photos from camera source HOT 3
- Won't initialize when `xfbml: false` given
- Unsupported Browser:: Facebook login does not work from chrome on iPhone. HOT 2
- Minified version of 1.4.4 causes injector error HOT 2
- Dynamic set the locale HOT 2
- Get ezfb to work with import HOT 2
- To show all public posts that are present in Page or a person in facebook?? HOT 3
- apk file created by android studio using ionic framework not working HOT 2
- facebook endpoint changed from *.net to *.com HOT 2
- Angular2 Version? HOT 2
- can i make the custom fb like button and call some controller function on click of that button. HOT 1
- doesn't render FB login button after navigating to different page and back HOT 3
- long-lived token
- How to use fb-login-button directive HOT 1
- In Android device error getting the sdk
- Login Button doesn't work HOT 3
- No way to exchange short-term tokens for long-term tokens
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular-easyfb.