You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, when I try to do this for a nested object, the scope of FormState is the nested object itself and not the entire object.
What I want to do is - check for Advertiser.Name, Advertiser.category and Advertiser.Prohibitions only if organizationType is not undefined. If I try to do this - the auto-completion in my IDE only shows this :(
sorry, this might be flakey/not precise with no stackblitz or anything, but essentially you just need to scope your updates to the context of the entire form, so you can query outside the intended updateGroup
constformValidation=updateGroup<CreateOrganizationForm>({// @ab: shorthand for `advertiserBrands`, gets passed explicitly to child `updateGroup`// @form: the parent `FormGroupState`advertiserBrands: (ab,form)=>updateGroup<AdvertiserBrands>(ab,{// @c: shorthand for `FormControlState`name: c=>form.value.organizationType===OrganizationType.ADVERTISER ? validate(c,required) : c})})
Hello,
I have an object - which looks like this 👇
I know how to validate objects
conditionally
i.e, Validate name, only if ID is presentlike so
However, when I try to do this for a nested object, the scope of FormState is the nested object itself and not the entire object.
What I want to do is - check for
Advertiser.Name
,Advertiser.category
andAdvertiser.Prohibitions
only iforganizationType
is not undefined. If I try to do this - the auto-completion in my IDE only shows this :(How do I do this correctly 🤔
(What I have currently ☝️)
The text was updated successfully, but these errors were encountered: