In angular CLI when creating module we can add --routing-scope as a parameter.
ng g m dashboard --routing-scope something-here --routing
when using this command I get error:
Schematic input does not validate against the
Schema: {"routingScope":"dashboard","routing":false,"spec":true,"flat":false,"commonModule":true}
Errors: Data path ".routingScope" should be equal to one of the allowed values.
But what are the allowed values?
This parameter is not described in the docs.
After some digging, I found this: schema.json, the schema.json for the CLI. Lots of good stuff in this.
According to this, the valid values for --routing-scope are either Child, or Root. Casing matters. The default is Child.
An odd thing is, the code that gets generated looks exactly the same no matter what value I use. They both look like what is below after running ng g m testing --routing-scope Child or ng g m testing --routing-scope Root
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [
CommonModule
],
declarations: []
})
export class TestingModule { }
Further digging shows that the value is used when code is generated to build the forRoot or forChild function in module imports.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With