How to inject service into controller of kibana plugin?

I created new plugin and in that plugin I write one controller and one service.
So I would like to inject that service into a controller. How could I do this ?
So can anyone give me a solution ?
Thank you !

Using your apps module (or create a new one and make it a dependency of your apps module), you have to register your service and then add it as an argument to your controller

const app = require*'ui/modules').get('app/namespace');
app.service('CustomService', () => {

});
app.controller('myController', function(CustomService) {

})

Thank you for your suggestion. I will check it. :grinning:

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.