Again... This has nothing to do with Angular or the "app module". This is
how ES6 imports and Typescript work and it is how imports work in most
languages. Every module/file that needs a definition must import the file
that contains that definition. In this case, the definition is for the Http
module. This is so the system knows exactly which module you mean to
reference within your module.

Module imports are not inherited because it would make certain things
impossible. For example: no module that you imported could ever have a
module with the same name as any other module in any library that you are
using.

On Sun, Jan 1, 2017 at 6:14 AM Sathish VJ <[email protected]> wrote:

> Would it not be enough then to do it in the app module since it will be
> available down the component tree?
> Or is it only certain things that are available in the hierarchy?  If yes,
> which ones are they?
>
>
> On Sunday, 1 January 2017 16:38:56 UTC+5:30, Lucas Lacroix wrote:
>
> Hi Sathish,
> You're importing the definitions so that they can be referenced within
> your code.
>
> This is fairly typical of most languages that do imports (Java, C++, C#,
> etc.) and is not specific to Angular.
>
> On Sun, Jan 1, 2017 at 5:55 AM Sathish VJ <[email protected]> wrote:
>
> I did not quite understand what needs to be imported only once and what
> all multiple times.
>
> Why is it not enough to import Http only once in app-module?  Why do I
> have to import it again in every service?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular" group.
>
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
>
>
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
> --
> Lucas Lacroix
> Computer Scientist
> Advanced Technology Division, MEDITECH <http://ehr.meditech.com/>
> 781-774-2293
>
> --
> You received this message because you are subscribed to the Google Groups
> "Angular" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Lucas Lacroix
Computer Scientist
Advanced Technology Division, MEDITECH <http://ehr.meditech.com/>
781-774-2293

-- 
You received this message because you are subscribed to the Google Groups 
"Angular" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to