【发布时间】:2016-09-19 19:19:16
【问题描述】:
我是一名学生,我的团队参加了写作应用比赛。只有这么少的编码知识,我们无法找出以下代码的问题:
angular.module('app.controllers', [])
.controller('studentLoginCtrl', function($scope) {
function login(username,password) {
var ref = new Firebase("https://project-2767910204862952587.firebaseio.com");
ref.authWithPassword({
email : username,
password : password
}, function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
window.location = "/SFront";
}
});
}
})
我们已经查阅了相当多的教程和大量的试验和错误。运行代码没有显示错误,但它什么也没做。
链接到动作的按钮代码如下:
<button ng-click="login(username, password)" id="studentLogin-button7" style="font-weight:;" class=" button button-balanced button-block icon-left ion-android-checkmark-circle ">Log in</button>
我已经使用 ng-model 来引导用户名和密码数据了。
<ion-list id="studentLogin-list2" class=" ">
<label class="item item-input " id="studentLogin-input4">
<span class="input-label">Username</span>
<input type="email" placeholder="Email" ng-model="username">
</label>
<label class="item item-input " id="studentLogin-input5">
<span class="input-label">Password</span>
<input type="password" placeholder="Password" ng-model="password">
</label>
请任何专家告诉我们问题的根源在哪里以及如何解决这个问题?
【问题讨论】:
标签: javascript angularjs ionic-framework firebase-authentication