Angular-cli: Put generated App-Component in seperate app-folder

Created on 11 May 2019  路  6Comments  路  Source: angular/angular-cli

馃殌 Feature request

Command (mark with an x)

  • [x] new
  • [ ] build
  • [ ] serve
  • [ ] test
  • [ ] e2e
  • [ ] generate
  • [ ] add
  • [ ] update
  • [ ] lint
  • [ ] xi18n
  • [ ] run
  • [ ] config
  • [ ] help
  • [ ] version
  • [ ] doc
    ```

Description

Move the auto-generated files of app-Component to a separate app-Folder.
Its confusing for beginner, when they search for app-Folder. It exists, but it consists of more then the app.component related filed

Describe the solution you'd like

src/

  • app/
    --app/
    ---app.component.ts
    --- app.component.html

Describe alternatives you've considered

Or maybe name the auto-generated entryComponent different like "helloComponent" with a specified file

schematicangular RFC / discussion / question

All 6 comments

This request is somewhat similar to https://github.com/angular/angular-cli/issues/10359

And I believe the same resolution applies.

@alan-agius4 thanks. I didn't found that. Even if @StephenFluin 's answer is not wrong, the structure of the 1st component always confuses beginners in our ngGirls workshop, because they expect different from a component.

src/app and app.module are corresponding to each other, because it's related to the application and not necessarily to the app-Component. The boostrapped component doesn't have to be necessarily called app.component. Or vise versa src/app and app.module could be named differently.

It's really confusing. I saw it a lot of times in our workshop.

At stackblitz they created a one-file hello-component. Maybe we could use this approach and create a hello component instead of an appComponent.

Just if the component is a one-file like on stackblitz, it can make sense to put it in the same folder.

For sure for us experienced developers or for grown apps it is not an issue, but we should make the onboarding for newcomers easier and this is one point they stucking to understand component model and file structure of an angular application.

I guess I had recently at ngConf with @robwormald a discussion about that confusing structure for beginners.

I wasn鈥檛 aware of the convo with @robwormald.

That said for me though the app component is bit of a special case that really is the main entry of the application and is easily found if it鈥檚 in the root folder rather then a sub folder mixed with other feature components.

Let鈥檚 see if either @robwormald & @StephenFluin have more inputs on this and if we shall do something about this.

As the application MUST have at least one app-level component, it seems to me to fit that it can be treated differently. I believe it does correspond well to the "app" and AppModule.

Closing as per above.

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._

Was this page helpful?
0 / 5 - 0 ratings