I have an variable: public tick:number;
in service.
The service has injection of another service Timer. It is launched like as:
class Service {
constructor(public timer: TimerService)
}
public sendSmsExect(){
// Main sending
}
public sendSms(){
this.timer.run().subscribe((tick => { if(tick == 30) { sendSmsExect(); } }));
}
}
Component:
class MyComponent {
public constructor(public service Service){}
public sendSms(){
this.service.sendSms();
}
}
Problem: I need to get access to tick varaible in template:
{{tick}}
Do I really think that I need to subscribe to tick
also in component and define the same variable tick
:
public sendSms(){
this.service.sendSms().subscribe((tick) => this.tick = tick );
}