K
K
Konstantin2020-01-30 11:28:42
Angular
Konstantin, 2020-01-30 11:28:42

How to use custom class in Angular service?

There is a service:

@Injectable({ providedIn: "root" })
export class LayersSemantic {

}


And also a custom class:

export class A {
   do() {}
}


How to use class A in a service?

There are other options besides creating an instance:

@Injectable({ providedIn: "root" })
export class LayersSemantic {
   private a: A;
   constructor0 {
         this.a = new A();
   }
}

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question