Destroy the Injectable service in a component

nativescriptcore

#1

Hi

How to destroy or make the Injectable service to nil in a component or in it own class?


#2

It’s not typical for components to control the lifetime of services. Dependency injection and inversion of control (both used by angular) are meant to achieve the exact opposite. Do you mind providing more details about what you’re trying to achieve? I might be able to suggest an alternative design.

Here’s angular’s documentation on DI. They might have the info you’re looking for.
https://angular.io/guide/dependency-injection-pattern