Skip to content

ng g route should also add the route to the RouteConfig #287

Closed
@hansl

Description

@hansl

Tasklist:

  • add a angular-cli/router-config.ts to the scaffold. This is part of the project. The content of this file should have a comment at the top to say to not touch this file, and export a CliRouteConfig (open to name suggestions).
  • add a README.md to the angular-cli directory to explain that this is generated code. We will use this for other things such as providers and third party libraries.
  • import the CliRouteConfig in the default src/app/__name__.ts. The code should look something like [1].
  • ng generate route needs to add the route info to the router-config.ts. This includes importing the new route and adding it to the CliRouteConfig array.
  • ng generate route should have a flag --no-route-generation (open to suggestions) that avoid the addition of it to the CliRouteConfig array.
  • README.md documentation for this.
  • e2e tests for it.

[1]

@Component({
  selector: '<%= htmlComponentName %>-app',
  providers: [],
  templateUrl: 'app/<%= htmlComponentName %>.html',
  directives: [ROUTER_DIRECTIVES],
  pipes: []
})
@RouteConfig([

].concat(CliRouteConfig))
export class <%= jsComponentName %>App {
  defaultMeaning: number = 42;

  meaningOfLife(meaning?: number) {
    return `The meaning of life is ${meaning || this.defaultMeaning}`;
  }
}

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions