Category "ngoninit"

angular audio play on ngoninit not working

html code: <audio id="notification" src="../assets/audio/notification.mp3" autoplay="true" muted="muted"></audio> ts code: let audioPlayer = <H

Should I initialise an Angular service in its constructor or in the ngOnInit method of the app.component?

I'm new to Angular. I have a service that needs to subscribe to a subject provided by another service. If this was a component, I would create the subscription

Why is ngOnInit called twice?

I trying to create new component, ResultComponent, but its ngOnInit() method is getting called twice and I don't know why this is happening. In the code, Result