@detached
The @detached
decorator is used to mark a method that is invoked when a certain critical property of the ConditionBlock
is detached (set to undefined
) and the ConditionBlock
is therefore about to be removed from the form definition (since its state becomes invalid). The decorator can be useful to interfere in this process and gives an opportunity to convert the condition block to a new valid state.
Decorator type
Method ℹ️
Applies to
Decorator signature
@detached(property: string)
Decorator parameters
Name | Type | Optional | Description |
---|---|---|---|
property | string | No | Specifies the property of the ConditionBlock to observe. |
Decorated method signature
(): (() => boolean) | void
Decorated method return value
The return value of the decorated method specifies what happens with the ConditionBlock
. If you return nothing, the block will be removed. But if you return a function, that function is invoked just before the ConditionBlock
will be removed. If that function, in turn, returns true
the block is no longer deleted. This is useful for condition blocks that can be converted to a new valid state and therefore may remain in the form.