Angularjs createUserWithEmailAndPassword失败:第一个参数";电邮;必须是有效字符串
我正在尝试创建一个用户并向firebase/angularfire注册,我想我正在遵循angularfire文档,但我有“createUserWithEmailAndPassword失败:第一个参数“email”必须是有效字符串。”消息Angularjs createUserWithEmailAndPassword失败:第一个参数";电邮;必须是有效字符串,angularjs,firebase,ionic-framework,firebase-authentication,Angularjs,Firebase,Ionic Framework,Firebase Authentication,我正在尝试创建一个用户并向firebase/angularfire注册,我想我正在遵循angularfire文档,但我有“createUserWithEmailAndPassword失败:第一个参数“email”必须是有效字符串。”消息 在此处输入代码 "严格使用",; 应用程序 .factory(“Auth”,[“$firebaseAuth”, 函数($firebaseAuth){ 控制台日志(“工厂”); 返回$firebaseAuth(); 控制台日志(“工厂”); } ]) .contr
在此处输入代码
"严格使用",;
应用程序
.factory(“Auth”,[“$firebaseAuth”,
函数($firebaseAuth){
控制台日志(“工厂”);
返回$firebaseAuth();
控制台日志(“工厂”);
}
])
.controller('homepageIndex',函数($scope){
})
.controller('homepageSignUp',['$scope','Auth',function($scope,Auth){
$scope.createUser=function(){
//创建新用户
Auth.$createUserWithEmailAndPassword($scope.email、$scope.password)
.then(函数(firebaseUser){
}).catch(函数(错误){
控制台日志(“错误”);
});
};
}
]);
如果它能帮助某人,我发现这样的方法,我不知道这是否是最好的方法:
<ion-view>
<ion-content padding="false">
<div class="list list-inset">
<label class="item item-input">
<input type="text" ng-model="newUser.email" placeholder="e-mail">
</label>
<label class="item item-input">
<input type="text" ng-model="newUser.password" placeholder="Password">
</label>
</div>
<div class="item item-divider text-center">
<a href="" class="button button-positive button-small" ng-click="registerUser(newUser)">
Enregistrez
</a>
</div>
</ion-content>
</ion-view>
'use strict';
app.factory("Auth", ["$firebaseAuth",
function ($firebaseAuth) {
return $firebaseAuth();
}
]);
app.controller('homepageIndex', function ($scope) {
});
app.controller('homepageSignUp', ['$scope', 'Auth', function ($scope, Auth) {
var newUser = $scope.newUser = { email: "", password: "" };
$scope.registerUser = function () {
Auth.$createUserWithEmailAndPassword(newUser.email, newUser.password)
.then(function (firebaseUser) {
console.log("yas", firebaseUser);
}).catch(function (error) {
console.log("error");
});
};
}
]);
"严格使用",;
app.factory(“Auth”,[“$firebaseAuth”,
函数($firebaseAuth){
返回$firebaseAuth();
}
]);
app.controller('homepageIndex',函数($scope){
});
app.controller('homepageSignUp',['$scope','Auth',function($scope,Auth){
var newUser=$scope.newUser={email:,密码:};
$scope.registerUser=函数(){
验证$createUserWithEmailAndPassword(newUser.email,newUser.password)
.then(函数(firebaseUser){
console.log(“yas”,firebaseUser);
}).catch(函数(错误){
控制台日志(“错误”);
});
};
}
]);
如果我在这里问显而易见的问题,很抱歉,但是您是否通过在其中抛出一个console.log()
来验证$scope.email
的值?当我抛出一个console.log($scope.email)时,结果是未定义的,我不明白为什么我也没有,但这可能是该方法抱怨您没有传递有效字符串的原因。
<ion-view>
<ion-content padding="false">
<div class="list list-inset">
<label class="item item-input">
<input type="text" ng-model="newUser.email" placeholder="e-mail">
</label>
<label class="item item-input">
<input type="text" ng-model="newUser.password" placeholder="Password">
</label>
</div>
<div class="item item-divider text-center">
<a href="" class="button button-positive button-small" ng-click="registerUser(newUser)">
Enregistrez
</a>
</div>
</ion-content>
</ion-view>
'use strict';
app.factory("Auth", ["$firebaseAuth",
function ($firebaseAuth) {
return $firebaseAuth();
}
]);
app.controller('homepageIndex', function ($scope) {
});
app.controller('homepageSignUp', ['$scope', 'Auth', function ($scope, Auth) {
var newUser = $scope.newUser = { email: "", password: "" };
$scope.registerUser = function () {
Auth.$createUserWithEmailAndPassword(newUser.email, newUser.password)
.then(function (firebaseUser) {
console.log("yas", firebaseUser);
}).catch(function (error) {
console.log("error");
});
};
}
]);