title: Ionic 4 and Angular 7/8 CLI command to generate a component with specific module
body: <p>I have an Ionic4/Angular 7/8 app. I want to create a component and have it auto configured in a specific module using the Angular CLI 7.3.9 and 8.1.3, but keep getting the error "File ... does not exist."</p>
  
  <p>None of the answers in this post works either.
  <a href="https://stackoverflow.com/questions/40649799/create-component-to-specific-module-with-angular-cli">Create component to specific module with Angular-CLI</a></p>
  
  <p><strong>Steps to reproduce the issue:</strong></p>
  
  <ol>
  <li>Create module: <code>ng g module pets</code></li>
  </ol>
  
  <p>This created a file named pets.module.ts in the [my_project_dir]/src/app/pets directory.</p>
  
  <ol start="2">
  <li>Generate a component and add to specified module using CLI 7.3.9 or 8.1.3</li>
  </ol>
  
  <pre><code>ng g component pets/cat --module=pets.module.ts
  ng g component pets/cat --module=pets/pets.module.ts
  </code></pre>
  
  <p>Executing the either the above command from my project directory or from the [my_project_dir]/src/app directory triggered this error message <strong>File pets/pets.module.ts does not exist.</strong></p>
  
  <p>Issuing this command <code>ng g component pets/cat -m pets.module.ts</code> in 7.3.9 created the component cat, but neither pets.module.ts or app.module.ts was updated.</p>
  
  <p>Issuing the command <code>ng g component pets/cat -m pets.module.ts</code> in 8.1.3 caused this error message: <strong>Unknown option: '-m'</strong></p>
  
  <p>As a workaround, I could update the module.ts file manually but would like to know the solution for future reference.  Any help is appreciated.  Thanks.</p>
  
  <p><strong>Updated 10/16/2019 6:30pm</strong></p>
  
  <p>It works if the Angular app is created using <code>ng new app-name</code> command, but does <strong>NOT</strong> if the app is generated via the <code>ionic start app-name blank --type=angular</code> command although the project structure is very similar between the two apps.</p>