just to preface-- I am new to angular so I apologize if this is not a good way to handle this problem!
So I have a scenario where there are x amount of rooms-- and for simplicity lets say that whenever someone goes in, I am able to get the time that happens.
So now I would like to see the elapsed time that someone has been in a room.
Here is the demo on Blitz.
I hardcoded the room instances but eventually I would fetch the values dynamically from a backend.
So the question I am trying to get to is if the way I am going about doing this process (specifically the elapsed time) the correct way? I set an interval in the RoomWidget Class and I manually set clear the interval with NgOnDestroy, but is that enough? I was thinking that even after doing that, the class instances are still alive and thus leaky. I just couldn't figure out a better way about solving this problem and felt as though I over complicated all of this.
I genuinely do appreciate any comments or constructive criticism I should be aware of for this stuff-- thank you!