Title: Ng Generator does not always save components in correct directory · Issue #7377 · angular/angular-cli · GitHub
Open Graph Title: Ng Generator does not always save components in correct directory · Issue #7377 · angular/angular-cli
X Title: Ng Generator does not always save components in correct directory · Issue #7377 · angular/angular-cli
Description: like #6431 Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Versions. @angular/cli: 1.2.7 node: 6.10.1 os: darwin x64 @angular/animations: 4.3.3 @angular/cdk:...
Open Graph Description: like #6431 Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Versions. @angular/cli: 1.2.7 node: 6.10.1 os: darwin x64 ...
X Description: like #6431 Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Versions. @angular/cli: 1.2.7 node: 6.10.1 os: darwin x...
Opengraph URL: https://github.com/angular/angular-cli/issues/7377
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Ng Generator does not always save components in correct directory","articleBody":"like #6431\r\n\r\n### Bug Report or Feature Request (mark with an `x`)\r\n```\r\n- [x] bug report -> please search issues before submitting\r\n- [ ] feature request\r\n```\r\n\r\n### Versions.\r\n@angular/cli: 1.2.7\r\nnode: 6.10.1\r\nos: darwin x64\r\n@angular/animations: 4.3.3\r\n@angular/cdk: 2.0.0-beta.8\r\n@angular/common: 4.3.3\r\n@angular/compiler: 4.3.3\r\n@angular/core: 4.3.3\r\n@angular/flex-layout: 2.0.0-beta.8\r\n@angular/forms: 4.3.3\r\n@angular/http: 4.3.3\r\n@angular/material: 2.0.0-beta.8\r\n@angular/platform-browser: 4.3.3\r\n@angular/platform-browser-dynamic: 4.3.3\r\n@angular/router: 4.3.3\r\n@angular/cli: 1.2.7\r\n@angular/compiler-cli: 4.3.3\r\n\r\nMac OS Sierra\r\n\r\n\r\n### Repro steps.\r\nIt's hard to give repo steps because I haven't discovered exactly what I have to do to reproduce.\r\nHowever, once the behaviour starts for a project, it continues to behave this way. The only way I have found to fix it is to start a completely new project and copy all my code over.\r\n\r\nThe issue is well described in #6431.\r\nIn brief, \r\n\r\n1. I cd to a module directory in my project eg: `app/admin`\r\n\r\n1. I create a new component, eg `ng g c users`\r\n\r\nInstead of creating the new component inside `app/admin/users`, it creates it inside app, eg `app/users`\r\n\r\nIn addition it creates an incorrect import statement in app.module, eg:\r\n`import { UsersComponent } from './admin/src/app/users/users.component';`\r\n\r\nI have seen this happen twice now. I can be working with a project for months and months with it working correctly, then one day it just stops working the way it should. The only way I have been able to fix it is to generate a completely new project and copy all my code over to the new project.\r\n\r\n\r\n### The log given by the failure.\r\nN/A\r\n\r\n\r\n### Desired functionality.\r\n\r\nIt should create the component inside the admin directory, eg:\r\n`app/admin/users`\r\n\r\nand it should create a well formed import statement in admin.module, eg:\r\n`import { UsersComponent } from './users/users.component';`\r\n\r\n\r\n### Mention any other details that might be useful.\r\nWhen I create a brand new project it does what I want it to. I have no idea what I do to provoke this behaviour. I have gone through the following files with a fine tooth comb and can't find anything wrong:\r\n\r\n- `.angular-cli.json`\r\n- `package.json`\r\n- `tsconfig.json`\r\n- `src/tsconfig.app.json`\r\n\r\nI can't think of anywhere else to look.\r\n","author":{"url":"https://github.com/chriscurnow","@type":"Person","name":"chriscurnow"},"datePublished":"2017-08-14T02:31:15Z","url":"https://github.com/angular/angular-cli/issues/7377"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:eb68cf3f-144d-bb25-66a4-e8a23eb01c57 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDB6:2E9D3B:32DDB8:3FDFF1:6B020978 |
| html-safe-nonce | ffec77116cbe8efb24142880b4091835e976dc134f86636695649191341b755e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREI2OjJFOUQzQjozMkREQjg6M0ZERkYxOjZCMDIwOTc4IiwidmlzaXRvcl9pZCI6IjcxMDU0NDU0MjM1NzMyNDAxODQiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 74cb6630c57240bd347ab164ec6e215e471eaaed57d3627b4251730ec8218029 |
| hovercard-subject-tag | issue:249918630 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/7377/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c8ab0ff7ba44b5d56c091457d105d65bb58132c24bf42573adf0b210aaded2a2/angular/angular-cli/issues/7377 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c8ab0ff7ba44b5d56c091457d105d65bb58132c24bf42573adf0b210aaded2a2/angular/angular-cli/issues/7377 |
| og:image:alt | like #6431 Bug Report or Feature Request (mark with an x) - [x] bug report -> please search issues before submitting - [ ] feature request Versions. @angular/cli: 1.2.7 node: 6.10.1 os: darwin x64 ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | chriscurnow |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width