angularjs - Angular firebase, cant login using factory -


i error when try login using code. part of creating user works , login methods used identical. chrome gives me error message:

typeerror: undefined not function     @ object.loginuser (http://localhost:8080/js/app.js:28:10)     @ scope.homecontroller.$scope.loginuser (http://localhost:8080/js/app.js:197:9) 

this html:

<button ng-click="createuser(email, password)">create user</button> <button ng-click="loginuser(email, password)">login</button> 

in controller:

$scope.createuser = function(email, password) {     auth.createuser(email, password);  }  $scope.loginuser = function(email, password) {     auth.loginuser(email, password); } 

and factory:

(function () {     angular         .module("myquiz")         .factory("auth", ["$firebaseauth", function($firebaseauth) {             var ref = new firebase("https://angularquiz.firebaseio.com/");              return {                 createuser: function(email, password) {                     ref.createuser({                         email: email,                         password: password                     }, function(error, userdata) {                         if(error) {                             console.log("error creating user: ", error);                         } else {                             console.log("succesfully created account uid: " + userdata.uid);                         }                     });                 },                 loginuser: function(email, password) {                     ref.authwithpassword({                         email: email,                         password: password                     }, function(error, authdata) {                         if(error) {                             console.log("login failed! " + error);                         } else {                             console.log(authdata + "succesfully authenticated!");                         }                     });                 }             }     }]); })();  

typo, authwithpassword not authwithpassword!

it works now


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -