I created a class (not component) and I want it to use data from a provider (MyService). ex:
export class MyClass {
arg1 : Number;
constructor(arg : Number, private myService : MyService) {
this.arg1 = arg;
}
calc() {
console.log(this.arg + this.myService.arg2);
}
}
Now, I want to create new instance of this class:
let a : MyClass = new MyClass(7);
but I have 1 argument missing... How can I create instances of class that has provider(s)? Is it possible? or maybe I'm not using it well?
private that myService : MyServiceis this that is define in your provider constructor