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 A binding filter function
metadata InjectionMetadata (Optional)

Returns:

(target: Object, member: string | undefined, methodDescriptorOrParameterIndex?: number | TypedPropertyDescriptor<any> | undefined) => void

Example

class MyControllerWithView {
  @inject.view(filterByTag('foo'))
  view: ContextView<string[]>;
}