I am using angular-facebook module for adding Facebook Login capability to my application.
Generally I get the following error while loading the page:
The "fb-root" div has not been created, auto-creating
Cannot read property 'appendChild' of null
When I get this error the facebook login popup comes empty/blank or unable to login.
My angular module dependencies are below:
angular.module('myApp', ['ngResource', 'ngRoute', 'facebook', 'restangular', 'LocalStorageModule'])
My index.html:
<html>
<head>
..
..
<script src="index.js"></script>
<script src="assets/js/default.js"></script>
</head>
<body ng-view>
</body>
</html>
The problem occurs because of
ng-view
tag in<body>
ngRoute organizes the content of body itself but facebook js sdk tries to control 'fb-root' div under body.The solution is to move ng-view to an inner div under body and create a fb-root div optionally: