I am new to Angular & typescript , trying to understand HttpClient, observables & subscribe
When i do this in a function of a component
console.log(this.http.get('assets/user.json'));
I am receiving an object but can not see any request going to https://localhost:4200/assets/user.json
in debugger network
while if i change code to
this.http.get('assets/userDetail.json').subscribe(data => this.user = { name: data['name']});
I can see the network request hitting the required URL. why this is happening ? my understanding was this.http.get('assets/userDetail.json')
will hit the url even if we does not subscribe to response data stream.