What is the best way to delete a component with CLI

后端 未结 14 1446
时光取名叫无心
时光取名叫无心 2020-12-22 18:35

I tried using \"ng destroy component foo\" and it tells me \"The destroy command is not supported by Angular-CLI\"

How do we properly delete components with Angular

14条回答
  •  自闭症患者
    2020-12-22 18:52

    I am not sure if it is the best way, but it worked for me.

    • First, I deleted the component folder.
    • Then, I cleared app.module.ts, app.component.ts & app.component.html of the imports and declarations related to the component I wanted to delete.
    • Similarly, I cleared main.ts.

    I just saved and refreshed the app and it worked.

提交回复
热议问题