K
K
Konstantin2018-10-28 10:52:26
Angular
Konstantin, 2018-10-28 10:52:26

Do I need to specify providers in the child component?

Do I need to re-specify the dependency (service) in providers=[Service]if it has already been defined in the main module or the child module in which the component is imported?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Demian Smith, 2018-10-29
@Junart1

Here everything is described in detail https://angular.io/guide/providers
Here is a brief extract:
To answer your question: no, you don't need it if the service is already declared in the module.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question