私は学生であり、私のチームはライティングアプリのコンテストに参加しました。私たちは、次のコードで問題を把握できなかった知識をコーディングするだけで、このような少量:Googleのfirebaseをionicのcontroller.jsファイルにリンクする方法は?
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-モデルを使用しました。
<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>
問題の原因はどこにあり、どのように修正するのか教えてください。
ありがとうございました。問題を解決しました。 –
@ GeoffreyLau:これは解決策ですか?もしそうなら、ティックマークをクリックしてそれを受け入れてください - それは我々が人々にここで感謝する方法です。そうでない場合は、将来の読者に役立つかもしれないので、あなた自身の答えを加えてください。 – halfer