I'm very new in Angular Nx. I have to create reusable Angular component and store it as a Library according to Nx workspace structure. I can't find appropriate command. I tried create library using:
ng generate lib mylib
It creates library as expected, but I want to store there component which can be used later in my apps.
These are two separate actions - you have to generate a lib in order to create the lib in the workspace (and optionally have a module and import it into another module).
After you do this you can create a component inside this lib.
ng generate component mycomponent --project=mylib --module=mylib.module.ts --export
Note that we are exporting it to use it elsewhere.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With