0
私は、AngularJSでFirebaseを使用し、index.htmlのサイドナビゲーションバーを使用して単一ページアプリケーションを作成しています。
ログイン後、ユーザー名はサイドナビゲーションバーに表示しますが、コントローラの現在のページで$スコープが機能していることを確認します。
scotchApp.controller('mainController', function($scope) {
$scope.validateLogin = function()
{
var email = $scope.login.userName + "@xyz.co";
var password = $scope.login.password;
firebase.auth().signInWithEmailAndPassword(email, password).catch(function(error) {
$scope.message = "please enter the correct details";
});
firebase.auth().onAuthStateChanged(function(user)
{
if(user)
{
$scope.usermobile = $scope.login.userName;
window.location.assign("/#/equipment");
}
});
}
$scope.message = '';
});
私はこの作品を理解していません: "コントローラの現在のページで$スコープが動作しています。" - 明確にすることはできますか? –
なぜ 'window.location.hash =" /#/ equipment "を使わないのですか? ' –
@CliveSeebregts 実際に$ scopeは現在のルーティングページ で動作しますが、そのルーティングコントローラ –