Angular-cli: Giving the possibility to create component with associated module

Created on 16 Jan 2017  路  4Comments  路  Source: angular/angular-cli

It would be greate if we can use an option to auto-generate associated modules when creating components.

Most helpful comment

I think the appropriate way to think about this is to create the module first and then the component. If you create a component and want it added to a module that does not exist. You can create the module separately and manually add the component to the new module.

Just my $0.02 but I don't see the value in adding this functionality.

All 4 comments

@Brocco @johnpapa what do you think?

I think the appropriate way to think about this is to create the module first and then the component. If you create a component and want it added to a module that does not exist. You can create the module separately and manually add the component to the new module.

Just my $0.02 but I don't see the value in adding this functionality.

Thinking this out loud here ...

If I create a component and don't know which module to put it in, I might want to step back and first think about that module. Thus I would create the module first. Then go create the component.

Here is how I would reason about it ...

  1. If I knew I wanted the component to go in an existing module, I'd just create the comp.
  2. If I knew i wanted a new module for the component, I'd create the module, then the component.

I don't think we should make it add the component and a new module because it is super simple to add a module then add 1 or more components to it. In general, I'm not a fan of adding multiple different things at a time. I prefer each command to take care of itself and all of the varying options it already has (and that list already is getting large, IMO)

Also, I could see someone accidentally doing this more than once ... more than intended and having to delete the module and then forgetting to add the component to a declaration of another module.

So in short, I vote no.

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._

Was this page helpful?
0 / 5 - 0 ratings