FirebaseExtended / angularfire

AngularJS bindings for Firebase
MIT License
2.73k stars 632 forks source link

Firebase work with wordpress?? #494

Closed goids closed 9 years ago

goids commented 9 years ago

I'm developing a plugin in wordpress, the point is that I'm recovering information from firebase my plugin in wordpress, but only for console, when control data to be printed on my php page are not displayed.

This code work $scope.content = 'Test'; ///print in left right

but this code no work

FBURL.on("value", function(snapshot) {
            snapshot.forEach(function(childSnapshot) {

                childData = childSnapshot.val();
                $scope.contenido.push(childData);
                console.log($scope.contenido);
            });
        }, function (errorObject) {
          console.log("The read failed: " + errorObject.code);
        }); //no print

captura de pantalla de 2014-12-04 00 26 20

jwngr commented 9 years ago

This is because you are not properly hooking into the digest cycle of Angular. Since you posted this on the AngularFire repo, you should just use the AngularFire library, which handles all of these things for you automatically:

var sync = $firebase(FBURL);
$scope.contenido = sync.$asArray();
goids commented 9 years ago

Ok, thanks, I work, I have a problem now, is that using the generator angularfire in yeoman.

I made an app, and I put in the hosting of firebase and works very well, I am now going by parts that code to my wordpress plugin. and when I write in html <div ng-app = "nameOfMyApp">

I have this error.

Uncaught Error: [$injector:modulerr] http://errors.angularjs.org/1.2.16/$injector/modulerr?p0=aclAgendaApp&p1=Er…ns%2Ffirebaseapps%2Fbower_components%2Fangular%2Fangular.min.js%3A32%3A445)

this link of error. http://goo.gl/gVzJYU

katowulf commented 9 years ago

This isn't the repo for the yeoman generator. Try here. Also, check that your app.js has 'firebase' listed in the dependencies.