I got ReferenceError: Firebase is not defined during push the data into Firebase DB in AngularJS? -
how fix error ?
//here our controller code var app = angular.module("myapp", ["firebase"]); app.controller("myctrl", function($scope, $firebase, $firebaseobject) { $scope.submitdata = function() { var name = $scope.user; var pass = $scope.password; var firebaseobj = new firebase("https://angulardemo-72e92.firebaseio.com/"); var fb = $firebase(firebaseobj); fb.$push({ name: name,password: pass}).then(function(ref) { console.log(ref); }, function(error) { console.log("error:", error); }); } });
<html> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script> <script src="firebase.js"></script> <script src="angularfire.min.js"></script> <script src="app.js"></script> <script> // initialize firebase var config = { apikey: "aizasybqksccuxgkotmwbdspubfqvic-xt9p5dy", authdomain: "angulardemo-72e92.firebaseapp.com", databaseurl: "https://angulardemo-72e92.firebaseio.com", projectid: "angulardemo-72e92", storagebucket: "angulardemo-72e92.appspot.com", messagingsenderid: "230268694130" }; firebase.initializeapp(config); </script> <body> <div ng-app="myapp" ng-controller="myctrl"> enter name<input type="text" ng-model="user"><br> enter passwrod <input type="text" ng-model="password"> <button type="sumbit" name="sumbit" value="sumbit" ng-click="submitdata()">login</button> </div> </body> </html>
hello sir, have push data firebase db got error firebase undefined, in angularjs please tell me whats wrong in code ?
Comments
Post a Comment