how do i generate an an…

less than 1 minute read

how do i generate an angular module/component inside an angular lib?

Responses:

use the --project flag :slightly_smiling_face:

basically if you want to generate into libs/mylib then you run ng g m mymodule --project=mylib

notice that if you have nested folders, like libs/shop/articles then the names are being dasherized, meaning the --project will be shop-articles in this case.

Just have a look in the angular.json (or workspace.json)

i get command not found: ng do I need to do something like npm link @angular/cli or how did you get to run ng commands in your workspace? I always used nx generate @nrwl/angular:*

use nx

got it. I ran ` nx generate @nrwl/angular:module mymodule –project=shared-forms`

it helped looking at the nx.projects. Not a fan of the dasherized project name, but i am not gonna rename them all. Thanks for the help.

Updated: