Angular-cli: ng destroy component does not remove component from app.module.ts file

Created on 22 Sep 2016  路  8Comments  路  Source: angular/angular-cli

  1. Operating System:
    Mac OSX 0.11.6 El Capitan
  2. Version:
    angular-cli: 1.0.0-beta.15
    node: 6.6.0
    os: darwin x64
  3. Steps to reproduce
    ng new new-app; cd new-app/src/app
    ng g component foo
    ng destroy component foo
    Notice that the src/app/app.module.ts file still has references to the foo component.

Most helpful comment

In my experience the best way is to use git to figure out what was added. It's usually easy to figure out the new files, but not so easy to figure out the added imports.

We've talked about how generators maybe shouldn't auto-add the imports, but haven't decided if it's worth to change it.

All 8 comments

Hey, Im have same issue but cant find any info(

The ng destroy command isn't supported. It doesn't show in ng help anymore as well.

@filipesilva What's the best way to destroy a generated component or directive then?

+1
How do we delete components properly if not with ng destroy?

In my experience the best way is to use git to figure out what was added. It's usually easy to figure out the new files, but not so easy to figure out the added imports.

We've talked about how generators maybe shouldn't auto-add the imports, but haven't decided if it's worth to change it.

@filipesilva Maybe list the files edited on generating new components + the new files?

That's a really good idea @MohamadAtieh. We list the created files but don't list the edited ones. I'll make an issue for it.

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

Related issues

jmurphzyo picture jmurphzyo  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

IngvarKofoed picture IngvarKofoed  路  3Comments

purushottamjha picture purushottamjha  路  3Comments

hareeshav picture hareeshav  路  3Comments