const initialState: State = {
config: {
time: '',
isAdmin: false
}
};
@StoreConfig({ name: 'my-store' })
export class MyStore extends Store<State> {
constructor() {
super(initialState);
}
}
export class MyComponent implements OnInit {
formKeyBased: FormGroup;
persistFormKey: PersistNgFormPlugin;
constructor(private myStoreQuery: MyStore,
private builder: FormBuilder) {}
ngOnInit() {
this.formKeyBased = this.builder.group({
time: this.builder.control(''),
isAdmin: this.builder.control(null)
});
this.persistFormKey = new PersistNgFormPlugin(this.myStoreQuery, 'config').setForm(this.formKeyBased);
}
}