Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(@schematics/angular): use same property order in standalone AppComponent #24911

Merged
merged 1 commit into from Mar 24, 2023

Conversation

cexbrayat
Copy link
Member

PR Checklist

Please check to confirm your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

Currently, the standalone app.component.ts looks like:

@Component({
  selector: 'app-root',
  standalone: true,
  templateUrl: './app.component.html',
  styleUrls: ['./app.component.css'], 
  imports: [CommonModule]
})

whereas a generated component looks like:

@Component({
  selector: 'app-user',
  standalone: true,
  imports: [CommonModule],
  templateUrl: './user.component.html',
  styleUrls: ['./user.component.css']
})

Note that the imports are not always in the same place.

What is the new behavior?

The imports are moved to a similar place than in other components.

Note that we could choose the other option (change it in the component template instead of app.component.ts),
but as app.component.ts is the most recent, I chose to update this one

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

This can replace #24905

…mponent

The `imports` are below the `standalone` property when generating a new component with `ng g c`.
This commit moves the `imports` of the standalone `app.component.ts` file to be in a similar place.
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release labels Mar 24, 2023
@angular-robot angular-robot bot merged commit 85fe820 into angular:main Mar 24, 2023
7 checks passed
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Apr 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker target: minor This PR is targeted for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants