question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Import Module while generating Submodule with --routing uses RoutingModule

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:16 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
cyrilletuzicommented, Jun 7, 2017
ng new app --routing
ng g module test -m app --routing

without =

AppModule imports TestRoutingModule instead of TestModule

2reactions
sumitaroracommented, Jun 1, 2017

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular2 Routing: import submodule with routing + making it ...
The accepted answer is the best way to do it: create the routes in the module, register them externally. Thus you can modify...
Read more >
Angular Routing between modules - TekTutorialsHub
The forChild method imports RouterModule but does not registers its services. Hence it should be all other modules. Example App. Create an ...
Read more >
How to create module with Routing in Angular 9
Create a new Angular Application: Using the following command, ... Then add the routes to the routing.module.ts file and then import the ...
Read more >
How to use modules to route and authorise users in Angular.
When you hit the route specified, it will then use its routing module to determine which component to load and voila, you have...
Read more >
Lazy-loading feature modules - Angular
In the lazy-loaded module's routing module, add a route for the component. ... Create the feature module with the Angular CLI, using the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found