Skip to content

Import Module while generating Submodule with --routing uses RoutingModule #6533

Closed

Description

@web-dave

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting
- [] feature request

Versions.

@angular/cli: 1.1.0
node: 6.9.4
os: win32 x64
@angular/animations: 4.1.3
@angular/common: 4.1.3
@angular/compiler: 4.1.3
@angular/core: 4.1.3
@angular/forms: 4.1.3
@angular/http: 4.1.3
@angular/platform-browser: 4.1.3
@angular/platform-browser-dynamic: 4.1.3
@angular/router: 4.1.3
@angular/cli: 1.1.0
@angular/compiler-cli: 4.1.3
@angular/language-service: 4.1.3

Repro steps.

  • I simple started a Project with ng new bar --routing
  • Then i want to generate a submodule ng g module foo --routing -m=app.modules

The log given by the failure.

Output:

  create src\app\foo2\foo-routing.module.ts
  create src\app\foo2\foo.module.ts
  update src\app\app.module.ts
  • app.module.ts:
@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    AppRoutingModule,
    FooRoutingModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})

Desired functionality.

FooModule should be imported!

Mention any other details that might be useful.

Activity

  1. changed the title [-]Import Module while generating uses wrong module[/-] [+]Import Module while generating Submodule with --routing uses RoutingModule[/+] on Jun 1, 2017
  2. web-dave commented on Jun 1, 2017

    @web-dave
    Author

    It seems to happen only if I generate a module with --routing

  3. self-assigned this
    on Jun 1, 2017
  4. cyrilletuzi commented on Jun 1, 2017

    @cyrilletuzi
    Contributor

    I confirm this issue.

  5. sumitarora commented on Jun 1, 2017

    @sumitarora
    Contributor

    @web-dave @cyrilletuzi It's work fine just 1 typo ng g module foo --routing -m=app.module instead of ng g module foo --routing -m=app.modules

  6. cyrilletuzi commented on Jun 1, 2017

    @cyrilletuzi
    Contributor

    Well in my case, it was not this typo, it was because I was induced in error by the issue (indicated in the changelog #5377) this new feature solved, where it's written without a = :
    ng g module test -m app.module

    As ng g module test -m throws and ng g module test -m badpath/app.module throws too, I thought it was an alternative syntax I didn't know.

    Shouldn't the CLI throws in case of typos instead of doing something weird ?

  7. web-dave commented on Jun 2, 2017

    @web-dave
    Author

    My Super hero power: Typos!!
    But confusing, cause without --routing it works.

  8. sumitarora commented on Jun 6, 2017

    @sumitarora
    Contributor

    @cyrilletuzi It does work as expected. I checked it again. Do you have steps to replicate the exact issue?

  9. cyrilletuzi commented on Jun 7, 2017

    @cyrilletuzi
    Contributor
    ng new app --routing
    ng g module test -m app --routing
    

    without =

    AppModule imports TestRoutingModule instead of TestModule

  10. clydin commented on Jun 7, 2017

    @clydin
    Member
  11. cyrilletuzi commented on Jun 29, 2017

    @cyrilletuzi
    Contributor

    Now this issue happens with the normal and official commands :

    ng new someapp --routing --skip-git
    ng g module test --routing --module=app.module
    

    results in TestRoutingModule imported in AppModule instead of TestModule.

    That's a major issue.

  12. cyrilletuzi commented on Jul 2, 2017

    @cyrilletuzi
    Contributor

    Still here in cli 1.2.0. Submitted a PR.

  13. cyrilletuzi commented on Jul 20, 2017

    @cyrilletuzi
    Contributor

    Can someone review my PR ? It's a really annoying issue.

  14. shairez commented on Aug 7, 2017

    @shairez
    Contributor

    @Brocco or @filipesilva
    Seems like there is a PR for this issue, have you got a chance to review it yet?

    #goodnessSquad

  15. hansl commented on Aug 17, 2017

    @hansl
    Contributor

    Fixed in Schematics.

  16. doggy8088 commented on Aug 18, 2017

    @doggy8088
    Contributor

    @hansl I tested. It works. Thank you! But the ng g m no longer working. It can only be use ng g module to generate a new module. Is it a known issue?

  17. Brocco commented on Aug 21, 2017

    @Brocco
    Contributor

    @doggy8088 It is a known issue that I am actively working on.

  18. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  19. locked and limited conversation to collaborators on Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions