I have a doubt about when is destroyed a provider on Angular.
This is my a part of my provider:
...
@Injectable()
export class ApiHelper {
private myState = {};
constructor(){
console.log('constructor');
}
...
}
It is injected on Page Module (Lazy Loading) as a provider. When I enter for the first time to the page the log is showed and the myState variable is {}.
If I modify the myState variable with info and exit of this page and enter again, the page is detroyed and created again but the log of Providers constructor is not showed and the myState content is the last value modified into the page.
When I create a new instance of a page (constructor is executed) the injected provider is not created again?
Thanks