angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng g component in folder where currently residing creates component in root

Open NilsHolger opened this issue 9 years ago • 13 comments

when create a component in currently residing folder, my component is created in root structure: ngcli1

/c/dev/ng2clienttracker/src/app/clients/components ng g component new-cmp installing component create src\app\new-cmp\new-cmp.component.css create src\app\new-cmp\new-cmp.component.html create src\app\new-cmp\new-cmp.component.spec.ts create src\app\new-cmp\new-cmp.component.ts

NilsHolger avatar Dec 15 '16 07:12 NilsHolger

Could you fill out issues template to show what kind of version of the CLI you are using etc?

FYI, I am not having this issue on 1.0.0Beta-21 on macOS 10.12.2 with node 7.2.1 npm 4.0.3

Nikki1993 avatar Dec 15 '16 11:12 Nikki1993

@NilsHolger Here is the Answer.

Consider your project is recipe-book. first navigate to app folder by

  1. cd src
  2. cd app

then if you wants to create folder in app then simply type ng g c test

it will create in app folder now you wants to create component inside of test then type ng g c test/test2 it will create new component in test folder. see below pic

newcoponent

samiurrahman avatar Dec 15 '16 13:12 samiurrahman

As @Nikki1993 said, please follow the questionnaire provided when opening a new issue. I tried this on MacOSX Sierra and cli 1.0.0.beta.22-1 and it works properly.

screen shot 2016-12-15 at 12 22 12 pm

baruchvlz avatar Dec 15 '16 17:12 baruchvlz

This seems windows specific.

filipesilva avatar Dec 30 '16 15:12 filipesilva

No, this is not windows specific. I'm use angular-cli 1.0.0-beta24 and component not created in another component folder, but in root.

vtolstov avatar Jan 01 '17 13:01 vtolstov

I have this issue in Ubuntu 16.04 and CLI version 1.0.0-beta.24

omahm avatar Jan 05 '17 21:01 omahm

I have this issue on Windows 10, since beta version .23. I'm currently on 1.0.0-beta.24

martinstark avatar Jan 09 '17 15:01 martinstark

@NilsHolger Here is the Answer.

Consider your project is recipe-book. first navigate to app folder by

  1. cd src
  2. cd app

then if you wants to create folder in app then simply type ng g c test

it will create in app folder now you wants to create component inside of test then type ng g c test/test2 it will create new component in test folder. see below pic

newcoponent

samiurrahman avatar Jan 12 '17 04:01 samiurrahman

I have just tried to recreate this issue unsuccessfully, closing this issue as it cannot be reproduced, if you're still having the issue, please comment and we will re-evaluate.

Here is a screen-grab of my attempt to recreate. (with version 1.0.0-beta.25.5)

image

Brocco avatar Jan 15 '17 03:01 Brocco

Angular CLI: 1.6.4

  • Navigate at root of your project (test-app in this case)
  • issue command ng g c parentfolder/componentname (ng g c form-test/form-test-child in this case)

image

Result

image

themidnightgospel avatar Jan 17 '18 07:01 themidnightgospel

I do not want app folder, I want if I run ng g c test then test folder will generate in src

ex: ng g c test it will generate in "src/app/test" I do not want app folder here I want test folder is in src.

please suggest

sipolyashhivangi avatar Nov 06 '18 20:11 sipolyashhivangi

I think maybe lost in this thread was a question about how to specify the output directory of the generate command.

For example, right now it will always prefix the path with app/.

$ ./node_modules/.bin/ng generate component component/navigation
CREATE src/app/component/navigation/navigation.component.scss (0 bytes)
CREATE src/app/component/navigation/navigation.component.html (29 bytes)
CREATE src/app/component/navigation/navigation.component.spec.ts (656 bytes)
CREATE src/app/component/navigation/navigation.component.ts (346 bytes)

Would be great to get the result, but without app/, eg.

CREATE src/component/navigation/navigation.component.scss (0 bytes)

Is this possible through angular.json or CLI?

thescientist13 avatar Dec 12 '18 23:12 thescientist13

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.