Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More help with providing services #3371

Closed
Assignees
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion

Comments

@johnpapa
Copy link
Contributor

johnpapa commented Dec 3, 2016

OS?

Mac OSX Sierra

Versions.

angular-cli: 1.0.0-beta.21
node: 6.9.1
os: darwin x64

Repro steps

ng new foo
cd foo
ng g s bar

Suggestion

A warning message is shown that says
WARNING Service is generated but not provided, it must be provided to be used

Perhaps we can extend this to say

WARNING Service is generated but not provided, it must be provided to be used. Consider providing it in the closest NgModule [put module name here]. Read this link for more information about where to provide services [link to docs]

Details

I think not providing the service is correct behavior for the CLI because it is not clear cut. But adding suggestions and/or a link to docs may help the user.

@digimax
Copy link

digimax commented Dec 3, 2016

+1

@iainplimmer
Copy link

iainplimmer commented Dec 20, 2016

+1 - clambered around why this wasn't working from the CLI turns out it was me moving files around and not receiving correct warnings, but this pointed me right at what I was missing. So no googling would have been required.

@filipesilva filipesilva added command: generate P5 The team acknowledges the request but does not plan to address it, it remains open for discussion labels Dec 30, 2016
@Brocco
Copy link
Contributor

Brocco commented Dec 31, 2016

This could also be used when generating services: #3806

@clydin
Copy link
Member

clydin commented Dec 31, 2016

For services, I was thinking maybe a --provide option with support for several (tentatively named) keywords:

  • closest-module [default]
  • closest-component
  • root

@Brocco
Copy link
Contributor

Brocco commented Jan 15, 2017

For now I'm content with the warning showing when no additional config is provided and allowing the path of a module to be specified. Providing to a component is an approach that can be manually taken after viewing the provided warning.

@Brocco
Copy link
Contributor

Brocco commented Feb 10, 2017

When generating a service you can now specify where it will be provided with this PR #3811

@Brocco Brocco closed this as completed Feb 10, 2017
@sabbarbutt
Copy link

sabbarbutt commented Apr 24, 2017

ng g s services/apiservices --module=app.module

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P5 The team acknowledges the request but does not plan to address it, it remains open for discussion
Projects
None yet
7 participants