I am new to Angular 7 and running into an issue with Services that are 
supposed to be set-up as Singletons. I have two Services, ServiceA and 
ServiceB along with one component, ComponentA. So, ComponentA uses both 
services, A & B. ServiceB also has ServiceA injected into it. ComponentA 
calls a function on ServiceA at which point a variable is changed on 
ServiceA after data is returned. ComponentA then calls a function on 
ServiceB, at which point ServiceB tries to reference the previously changed 
variable on ServiceA. However, ServiceA is returning the initial value of 
the changed variable and not the new value. This leads me to believe that 
it's not actually a Singleton, but another instance of the service. I am 
registering the Services using:

@Injectable({
  providedIn: 'root'
})


Any idea what the issue may be here? There may be a better way to do this, 
but since I am new to Angular, this is the way I have it set-up for the 
time being. 

Thanks, in advance.

-- 
You received this message because you are subscribed to the Google Groups 
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to angular+unsubscr...@googlegroups.com.
To post to this group, send email to angular@googlegroups.com.
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to