TypeError: $firebaseAuth is not a function
ionic.bundle.js:26794 TypeError: Auth.$authWithPassword is not a function
at Scope.$scope.login (app.js:148)
at fn (eval at (ionic.bundle.js:27638), :4:206)
at ionic.bundle.js:65427
at Scope.$eval (ionic.bundle.js:30395)
at Scope.$apply (ionic.bundle.js:30495)
at HTMLAnchorElement. (ionic.bundle.js:65426)
at defaultHandlerWrapper (ionic.bundle.js:16787)
at HTMLAnchorElement.eventHandler (ionic.bundle.js:16775)
at triggerMouseEvent (ionic.bundle.js:2953)
at tapClick (ionic.bundle.js:2942)
I keep getting the above error. The controller is perfect. When used in a web app it works perfectly fine but in ionic it keeps giving error. Please help me.
My App.js ``
angular.module(ādbcareā, [āionicā,āfirebaseā])
.config(function ($stateProvider, $urlRouterProvider) {
$stateProvider
.state('login', {
url: '/login',
templateUrl: 'views/login.html',
controller: 'LoginCtrl'
})
.state('signup', {
url: '/signup',
templateUrl: 'views/signup.html',
})
$urlRouterProvider.otherwise('/login');
})
.factory(āAuthā, function($firebaseAuth) {
var ref = new Firebase(āhttps//travelhighlights.firebaseio.com/ā);
return $firebaseAuth(ref);
})indent preformatted text by 4 spaces
My Controller
.controller(āLoginCtrlā,[ā$scopeā,ā$ionicModalā,āAuthā,ā$locationā, function ($scope,$ionicModal,$location,Auth) {
$scope.login = function() {
var username = $scope.email;
var password = $scope.password;
Auth.$authWithPassword({
email: username,
password: password
})
.then(function(authData) {
console.log(āLogged in as:ā, authData.uid);
}).catch(function(error) {
console.error(āAuthentication failed:ā, error);
});
};
}])