Page Contents
Home > @loopback/context > inject > view
inject.view() function
Inject matching bound values by the filter function
Signature:
view: (bindingFilter: BindingFilter, metadata?: InjectionMetadata) => (target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void
Parameters
| Parameter | Type | Description |
|---|---|---|
| bindingFilter | [BindingFilter](/doc/en/lb4/apidocs.context.bindingfilter.html) | A binding filter function |
| metadata | [InjectionMetadata](/doc/en/lb4/apidocs.context.injectionmetadata.html) | _(Optional)_ |
Returns:
(target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void
Example
class MyControllerWithView {
@inject.view(filterByTag('foo'))
view: ContextView<string[]>;
}