DEV Community

Discussion on: Angular Component Subscription vs. AsyncPipe: Use Pipes When Possible

eyassh profile image

Is that line return this.http.get(this.configUrl) return observable , If yes then why din't we import observable from rxjs.

Yes, the this.http.get(...) line returns an Observable. In general my code snippets don't include the imports.

In general you can import specific types you depend on but that isn't actually strictly necessary. The implementation of HttpClient.get imports Observable and returns it, so all you need to do is include the implementation of HttpClient, which you do.

In general ES6 imports are for things you directly depend on. Those imports will transitively import any things they depend on.