@kacreation wrote:
hi everybody,
my problem : i have a global provider where I want to inject all variables needed for my app.
and i have TWO others providers (network and webwservices )that need to interact with this global provider.
My NetWork Provider check some basics fonctionnality and get the uuid device, No problem to inject this data in my globalProvider. I’m using this data again in my Webservices provider wich is use to interact with my Api (get and update data). So I post this data to my Api and get a object response with a token.
I’d like to reinject this token in my global Provider but it doesn’t work.I walways get my dat undefine in my global Provider.
here is my code :
webservicesProvider.tsreturn this.global.apiToken;this.http.post(this.url_api + '?action=getToken', dataToPost) .subscribe(data => { console.log(data); console.log(data['status']); if (data['status']==1){ console.log(data['token']); this.global.apiToken = data['token']; console.log(this.global.apiToken); }else{ console.log('erreur status'); }
and in my globalProvider.ts :
/***********Token *********/ public apiToken : string; public decryptToken : string;
i just made a console.log of my apiToken in the constructor and it returned Undefined.
Does somebody can help me ?
Posts: 1
Participants: 1