Page Contents

Home > @loopback/context > inject

inject namespace


export declare namespace inject 


Function Description
binding(bindingKey, metadata) Inject the binding object for the given key. This is useful if a binding needs to be set up beyond just a constant value allowed by @inject.setter. The injected binding is found or created based on the metadata.bindingCreation option. See BindingCreationPolicy for more details.
context() Inject the context object.
getter(bindingSelector, metadata) <p>Inject a function for getting the actual bound value.</p><p>This is useful when implementing Actions, where the action is instantiated for Sequence constructor, but some of action’s dependencies become bound only after other actions have been executed by the sequence.</p><p>See also Getter<T>.</p>
setter(bindingKey, metadata) <p>Inject a function for setting (binding) the given key to a given value. (Only static/constant values are supported, it’s not possible to bind a key to a class or a provider.)</p><p>This is useful e.g. when implementing Actions that are contributing new Elements.</p><p>See also Setter<T>.</p>
tag(bindingTag, metadata) Inject an array of values by a tag pattern string or regexp
view(bindingFilter, metadata) Inject matching bound values by the filter function