0

ember.js を使用するのはこれが初めてです。ユーザーが正常にサインイン (認証) されたときに、コントローラーを使用してアクションを実行しようとしています。ただし、ユーザーの状態を保存したり、プロパティ 'this.set('userSignedIn', state);' を変更したりする現在の方法 動かない。正確な理由はわかりませんが、'state' 変数のスコープに関係があるか、'this' オブジェクトが 'ref.authWithOAuthPopup()' に渡されていない可能性があります。誰かが正しい方向に向けられることを願っています。

var ref = new Firebase("https://<app>.firebaseio.com");
var state = false;
MyApp.ApplicationController = Ember.Controller.extend({
userSignedIn: false,
actions: {



    signin: function() {
        ref.authWithOAuthPopup("facebook", function(error, authData) {
          if (error) {
            console.log("Login Failed!", error);

          } else {
            console.log("Authenticated successfully with payload:", authData);
            state = true;

          }
        });
    this.set('userSignedIn', state);    
    console.log(state);
    }, // End of signin



}
});
4

1 に答える 1