Skip to content

ng new : Renaming AppComponent --> RootComponent #10359

@nicolasploquin

Description

@nicolasploquin

Versions

Angular CLI: 1.7.4
Node: 9.4.0
OS: win32 x64
Angular: 5.2.9

Repro steps

  • Create a new project with ng new first-project command
  • Create a new component with ng g c second command

Observed behavior

Ng-Cli produces a project with a first component named AppComponent with selector app-root
When we generate a second component using ng g c second, Ng-Cli produces a component SecondComponent with selector app-second in a folder named second.

@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css']
})
export class AppComponent {
  title = 'app';
}

Desired behavior

It would be more consistent to name the root component RootComponent and keep app as a reference to application module only, just like other components are generated.

@Component({
  selector: "app-root",
  templateUrl: "./root.component.html",
  styleUrls: ["./root.component.css"]
})
export class RootComponent {
  title = 'app';
}

Mention any other details that might be useful (optional)

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