问题描述
我正在尝试使用NGXS安装Ionic应用程序。 我正在做Auth部分。
到目前为止,我有这个模型:
export interface AuthStateModel {
profile: Profile | null;
loaded: boolean;
}
和此AuthState:
@State<AuthStateModel>({
name: 'auth',defaults: {
profile: null,loaded: false,},})
@Injectable()
export class AuthState {
@Selector()
static profile(state: AuthStateModel) {
return state.profile;
}
@Selector()
static isLoggedIn(state: AuthStateModel) {
console.log(state);<--- loggin the state value
return state.loaded;
}
constructor(private angularFireAuth: AngularFireAuth,private angularFireStore: AngularFirestore) {}
//... Some actions
}
在我的应用程序组件中,我正在这样做以检索状态值:
@Select(AuthState.isLoggedIn) isLoggedIn$: Observable<boolean>;
但是我真的不明白,看来状态已经设置好了,但是我的选择器仍然收到null:
我干了什么?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)