@teaser5001 wrote:
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);
});};
}])
Posts: 6
Participants: 3