vue-servicecontainer
v3.1.0
Published
ServiceContainer Plugin for VueJS
Downloads
5
Maintainers
Readme
vue-servicecontainer
Install
npm i vue-servicecontainer --save
Setup
Load the container plugin
let ServiceContainer = require('vue-servicecontainer');
Since we can't load the services dynamically in the browser we have to link files to their classes. These path should be exactly like those in the config file
Vue.use(ServiceContainer, {
json : require('./src/View/Config/Services.json'),
services : {
"../Service/Group.service.js" : require('./src/View/Service/Group.service'),
}
});
Config
{
"parameters": {
"group_service.file":"../Service/Group.service.js",
},
"services": {
"group": {
"file":"%group_service.file%",
"arguments":[]
},
}
}
Usage
In your component you have now the $container
property that links to the vue-servicecontainer
plugin
this.$container.get('group').Do_Something()