Skip to content

CLI v1.4.0-rc.1 ng new --routing generates erroneous app-routing.module.ts #7524

Closed
angular/devkit
#125

Description

@bogacg

Bug Report or Feature Request

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

Versions.

@angular/cli: 1.4.0-rc.1
node: 8.3.0
os: win32 x64

Repro steps.

ng new TESTPRO --routing

ng serve

To see the source generated (without ng serve): ng new TESTPRO -st -si --routing suffice.

app-routing.module.ts is generated in form:

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})

The log given by the failure.

Error: No provider for ChildrenOutletContexts!

Desired functionality.

A main routing module generated with .forRoot(routes)

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule]
})

Activity

  1. self-assigned this
    on Aug 28, 2017
  2. added 2 commits that reference this issue on Aug 29, 2017
    9b9da2c
    cd36763
  3. added a commit that references this issue on Aug 29, 2017
    953b582
  4. Basel78 commented on Oct 3, 2017

    @Basel78

    Hello,
    I am still facing this issue with new project in angular-cli, how to resolve this issue?
    Thanks

  5. Basel78 commented on Oct 3, 2017

    @Basel78

    Actually I resolved the issue by using the command below for creating app-routing
    ng g module app-routing
    the link below help me fix it
    https://shermandigital.com/blog/configure-routing-in-an-angular-cli-project/

  6. musmanzpak commented on Feb 23, 2018

    @musmanzpak

    I get one the best to understand about Angular routing and navigation including route params

  7. added a commit that references this issue on Jun 6, 2018
    eef2c19
  8. 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.

  9. 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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions