We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Loopback Mixins are defined as a function within your mixins folder (my-mixin.js):
my-mixin.js
module.exports = function(model, options){ // do your magic }
To make the Mixins available to the models one has to either add the source dir (or the files) to the _meta section of the model-config.json:
_meta
model-config.json
{ "_meta": { "mixins": [ "loopback/server/mixins", "../mixindir/relative/to/the/appRootDir", "@joinbox/thingy/mixins/whuat" ] } }
To hook in your mixin to a model, you can add it to the model's mixin section of the definition file (your-model.json:
your-model.json
{ "name": "YourModel", "mixins": { "MyMixin": { "optionValue": true } } }
Note: You don't have to specify options, you can just set the value of "MyMixin" to true.