Page Contents
Home > @loopback/context > Context > unbind
Context.unbind() method
Unbind a binding from the context. No parent contexts will be checked.
Signature:
unbind(key: BindingAddress): boolean;
Parameters
| Parameter | Type | Description |
|---|---|---|
| key | [BindingAddress](/doc/en/lb4/apidocs.context.bindingaddress.html) | Binding key |
Returns:
boolean
true if the binding key is found and removed from this context
Remarks
If you need to unbind a binding owned by a parent context, use the code below:
const ownerCtx = ctx.getOwnerContext(key);
return ownerCtx != null && ownerCtx.unbind(key);