首页 > 解决方案 > 在社交登录反应表单字段上出现错误

问题描述

我正在使用带有反应形式的 Angular。在我的登录页面上,有一个使用 FB 或 Google 帐户登录的选项。但是,一旦用户点击这些选项之一,输入字段就会变得无效并变成红色。这个问题有什么解决办法吗?为什么会这样?

popupWindow(provider: string) {
const fromState = this.store.selectSnapshot<any>((state) => state.userState).data as AccountModel;
const countryCode =  fromState && fromState.countryCode || environment.defaultCountryCode;
const dualScreenLeft = window.screenLeft;
const dualScreenTop = window.screenTop;
const width = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : screen.width;
const height = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : screen.height;
const left = ((width / 2) - (600 / 2)) + dualScreenLeft;
const top = ((height / 2) - (500 / 2)) + dualScreenTop;
const url = `${this.baseUrl}/api/Account/SocialExternalLogin?countryCode=${countryCode}&provider=${provider}&response_type=token&client_id=_self`;
const features = `location=0,status=0,scrollbars=yes, width=${600}, height=${500}, top=${top}, left=${left}`;
const newWindow = window.open(url, provider, features);

window['authCompleted'] = (localToken) => {
  this.setToken(JSON.stringify(localToken));
  this.store.dispatch(new fromAccount.UserAccountDetails());
  this.dialog.closeAll();
};

}

标签: angularangular-reactive-forms

解决方案


推荐阅读