Ismaestro / angular-example-app

Angular 17 Example App + Standalone Components + i18n + EsBuild
https://angular-example-app.netlify.app/
2.16k stars 1.21k forks source link

How to add new components? #146

Closed sunch1ld closed 1 year ago

sunch1ld commented 1 year ago

Hi

I am trying to add new component in the user module with ng g c command.

Launching this command:

src\app\modules\user\pages> ng g c newcomponent

appears this error:

Could not find an NgModule. Use the '--skip-import' option to skip importing in NgModule.

How can I add new component in page folder using cli command?

Thanks

Ismaestro commented 1 year ago

Hello!

As we are not using NgModules anymore, you have to skip the import as it says:

ng g c newcomponent --skip-import

The component must be standalone, more info here:

https://angular.io/guide/standalone-components

sunch1ld commented 1 year ago

Ok thanks work

Dr. Beniamino Ferrari


From: Ismael Ramos @.> Sent: Monday, March 27, 2023 12:54:20 PM To: Ismaestro/angular-example-app @.> Cc: sunch1ld @.>; Author @.> Subject: Re: [Ismaestro/angular-example-app] How to add new components? (Issue #146)

Hello!

As we are not using NgModules anymore, you have to skip the import as it says:

ng g c newcomponent --skip-import

The component must be standalone, more info here:

https://angular.io/guide/standalone-componentshttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fangular.io%2Fguide%2Fstandalone-components&data=05%7C01%7C%7C24167ce1f363452f348e08db2eb19edf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638155112631768810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=UR%2FBqqawbbkbNrCHBGz2ySFnPghoaI%2BHlNH0%2FbVQzJE%3D&reserved=0

— Reply to this email directly, view it on GitHubhttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FIsmaestro%2Fangular-example-app%2Fissues%2F146%23issuecomment-1484929899&data=05%7C01%7C%7C24167ce1f363452f348e08db2eb19edf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638155112631768810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=RjtYHUVW%2Fn0M1ICYwjynW6EoG1iJPZCm6vFSXDAyTEE%3D&reserved=0, or unsubscribehttps://emea01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAAJBRLXWONVZIUEJIKHHG7DW6FWVZANCNFSM6AAAAAAWJALJ4Y&data=05%7C01%7C%7C24167ce1f363452f348e08db2eb19edf%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C638155112631768810%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=g1qhuVxM%2FA0ZEU9ANt8GeqzUB2UliIo049edc2a44dI%3D&reserved=0. You are receiving this because you authored the thread.Message ID: @.***>