Hi,
Learning and practicing MEAN for couple weeks now and was able to make http get request api.
My Angular front end has button and onclick it calls method angular component -> then service ( all in TS). Service calls express backend to return json data.
Calls sequence & results in same order -->
Angular html page ( button + table of results returned by button click) -> Angular component TS -> Angular Service TS ( http get to express backend here) -> Express Router (Promise End http request to external server)
Angular http request is very simple and not using any fancy apis :
http.get(url).subscribe();
Express usings promise/then and http.request(options, function(res){})
Now, console.log at each level, I noticed that on first button click, my json at component level ( returned by service later) is null and thus first button click, results are not displayed on page. Second click, it works.
Why is that so? and do I need to introduce Observables here in Angular Service ?