标题未在angularjs中刷新

时间:2018-12-19 06:15:34

标签: javascript angularjs login google-login

我正在开发一个简单的登录应用程序。 每当用户在该页面上注册时,我便为标题或导航部分进行了代码编码,并且成功显示了他/她的个人资料图片,但问题是直到刷新整个页面后,导航才被刷新。 这是代码示例:

if(response.data.status=='404'){
    vm.registerModel.firstName = vm.loginModel.f_name;
    vm.registerModel.lastName = vm.loginModel.l_name;
    vm.registerModel.email = vm.loginModel.email;
    vm.registerModel.profile_image=vm.loginModel.profile_image;
    sessionStorage.setItem('user_profile_pic',vm.registerModel.profile_image);
    vm.registerModel.authProvider = AuthProviderTypes.GOOGLE;
    vm.registerModel.auth_id = vm.loginModel.auth_id;
    // vm.registerModel.userType = 'client';
    $window.localStorage.setItem("name", vm.loginModel.f_name);
    $window.localStorage.setItem("social_login", 'true');
    $window.localStorage.setItem('is_switch',true);
    vm.openMobileVerifyPopup();
    var registerModel={
        first_name:vm.loginModel.f_name,
        last_name:vm.loginModel.l_name,
        email:vm.loginModel.email,
        profile_image:vm.loginModel.profile_image
    };
    $window.localStorage.setItem("type",commonHelper.serializeObject(AuthProviderTypes.GOOGLE));
    var encodedString = commonHelper.serializeObject(registerModel);
    $window.localStorage.setItem("encodedString", encodedString);
    $window.localStorage.setItem("usr_details", encodedString);
    $window.localStorage.setItem("type",commonHelper.serializeObject(AuthProviderTypes.GOOGLE));
    if(vm.url==='http://localhost:3001/#!/home'){
        // $window.location.href="#/successful-login";
    }
    else{
        $window.location.href=vm.url;
    }

    //$location.path('/user/dashboard'+encodedString);
    vm.close();
    $rootScope.$broadcast('refresh-header');
}

0 个答案:

没有答案