Hi!
1) *ngIf="userData$ | async as user" is a more correct
2) Why do you use onSubmit, onReset as property and not as method?
3) Please study RxJS first! This is a mistake:
Hi, Thanks for valuable feedback,
Actually I'm happy to see comment on the implementation and core methodology to manipulate forms with data binding and rxjs is fine. so everyone can go with his implementation, I'm not "great" :D
about 1) you are right.
about 2) as mentioned everyone can go in his way, for me, I like to keep small components clear and simple. the idea from function to dispatch the subject, whatever the implementation (method/props/maybe inline arrow function in JSX).
about 3) I think I mentioned that I will never right the "great" way.
"onSubmit: again the place we collect the data (current observable value), you can use any Rxjs technique to fetch and again you can make the BehaviorSubject public and another option will be available to get the current data or make third util at service:"
and provided another solution.
const data = this.stateService.userData$.value;
// or in service
public getCurrentUserData = (): IUser => this.userData$.value;
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi!
1)
*ngIf="userData$ | async as user"
is a more correct2) Why do you use onSubmit, onReset as property and not as method?
3) Please study RxJS first! This is a mistake:
There is no guarantee that userData$ is not asynchronous...
Hi, Thanks for valuable feedback,
Actually I'm happy to see comment on the implementation and core methodology to manipulate forms with data binding and rxjs is fine. so everyone can go with his implementation, I'm not "great" :D
about 1) you are right.
about 2) as mentioned everyone can go in his way, for me, I like to keep small components clear and simple. the idea from function to dispatch the subject, whatever the implementation (method/props/maybe inline arrow function in JSX).
about 3) I think I mentioned that I will never right the "great" way.
"onSubmit: again the place we collect the data (current observable value), you can use any Rxjs technique to fetch and again you can make the BehaviorSubject public and another option will be available to get the current data or make third util at service:"
and provided another solution.