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
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
FooRoutingModule
],
providers: [],
bootstrap: [AppComponent]
})
FooModule should be imported!
It seems to happen only if I generate a module with --routing
I confirm this issue.
@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
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 ?
My Super hero power: Typos!!
But confusing, cause without --routing it works.
@cyrilletuzi It does work as expected. I checked it again. Do you have steps to replicate the exact issue?
ng new app --routing
ng g module test -m app --routing
without =
AppModule imports TestRoutingModule instead of TestModule
This appears to be the suspect code block: https://github.com/angular/angular-cli/blob/master/packages/%40angular/cli/blueprints/module/index.ts#L127
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.
Still here in cli 1.2.0. Submitted a PR.
Can someone review my PR ? It's a really annoying issue.
@Brocco or @filipesilva
Seems like there is a PR for this issue, have you got a chance to review it yet?
Fixed in Schematics.
@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?
@doggy8088 It is a known issue that I am actively working on.
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._
Most helpful comment
without
=AppModuleimportsTestRoutingModuleinstead ofTestModule