I use this particular command for generating components inside a module.
ng g c <module-directory-name>/<component-name>
This command will generate component local to the module. or You can change directory first by typing.
cd <module-directory-name>
and then create component.
ng g c <component-name>
Note: code enclosed in <> represent user specific names.