Custom Service is not initializing

I have created an angular service called myCustomService and registered as shown in this post. I’m getting service without initializing so I’m not able to call any methods from myCustomService.
my custom service is like this

import { Injectable } from '@angular/core';
import { MatDialog } from '@angular/material';
import { OpenDialogComponent } from '../../components/open-dialog/open-dialog.component';

  providedIn: 'root'
export class MyCustomService {
  constructor(private dialog: MatDialog) { }
   openDialog() {
    let dialogRef =, {
      width: '250px'
    dialogRef.afterClosed().subscribe((data: boolean) => {
      if (data) {

and i have registered this service like this

 { [BPMN.InjectionNames.myCustomService]: ['value', BPMN.MyCustomService] },

and i have injected my custom service like this

export class RTCamundaPropertiesProvider extends PropertiesActivator {
    static $inject = ['eventBus', 'bpmnFactory', 'elementRegistry', 'elementTemplates', 'translate', 'MyCustomService'];
    private camundaPropertiesProvider = new CamundaPropertiesProvider(this.eventBus, this.bpmnFactory, this.elementRegistry, this.elementTemplates, this.translate);
    private rtEntryFactory = new RTEntryFactory(this.eventBus);
    constructor(private eventBus: any, private bpmnFactory: any, private elementRegistry: any, private elementTemplates: any, private translate: any, private myCustomService: MyCustomService) {

here is my sample Git Hub project.
Thank you in advance

What’s the context? How are you instantiating the modeler?

hi @philippfromme
Thanks for the reply. I am instantiating modeler in playGround-component.ts like below

  loadModeler() {
    this.container = document.getElementById('js-drop-zone');

    this.modeler = new RtBpmnModeler({
      container: '#js-canvas',
      keyboard: { bindTo: document },
      propertiesPanel: { parent: '#js-properties-panel' },
      elementTemplates: BPMN.CustomElementTemplate,
      additionalModules: this.additionalModules(),
      moddleExtensions: this.moddleExtensions(),

    this.modeler.on('elementTemplates.errors', function (event) {
      console.error('template load errors', event.errors);
    this.diagramXml = this.xml;
    this.modeler.on('commandStack.changed', this.export.bind(this));

Make sure to specify the __init__ property in your module to make sure it will be instantiated.

Hi @philippfromme
i have made changes for initializing the service as you suggested

  { __init__: [BPMN.InjectionNames.myCustomService], MyCustomService: ['value', BPMN.MyCustomService] },

still It is not initializing and I’m getting the error. Is there anything wrong in initialization?

This seems to be a problem with one of your custom provider’s methods. Have you tried to debug into the issue?

It is not even hitting the custom provider’s method. If i create instance for that service in
rtCamundaPropertiesProvider.ts then the provider methods are available and working fine. But my problem is I don’t create instance my class using new keyword. sharing any example which is having custom service is very helpful.
Thank you

This example bundles custom modules. Have you had a look at it yet?

Yeah I have seen that Example but I have problem with only Angular Services not with any other Services.

I’m sorry, I can’t help you with AngularJS-related issues as I am not familiar with the framework.

Ensure you pass the service name in the __init__ block rather than a reference to an object:

module.exports = {
  __init__: [ 'someService' ],
  someService: require('./someService')

If that does not help you, share a minimal test case / setup that allows us to look into what you’re doing and figure out why it may not be working.

I have encountered the same problem. Can I see your code?