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

feat(router): allow providing metadata in routes #55400

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

devknoll
Copy link
Contributor

The Meta service directly exposes HTMLMetaElements, and therefore requires DOM emulation to use. In order to allow setting page metadata without DOM emulation, introduce support on the route, similar to title.

PR Checklist

Please check if 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
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Issue Number: N/A

What is the new behavior?

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

@angular-robot angular-robot bot added the detected: feature PR contains a feature commit label Apr 18, 2024
The Meta service directly exposes HTMLMetaElements, and therefore requires DOM emulation to use. In order to allow setting page metadata without DOM emulation, introduce support on the route, similar to title.
@devknoll devknoll marked this pull request as ready for review April 22, 2024 22:07
@devknoll
Copy link
Contributor Author

friendly ping @AndrewKushnir

*
* @publicApi
*/
export interface MetadataEntry {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drive by: Doesn't TS' existing DOM APIs have this information? Would we use one of those types?

That might only contain properties and not attributes, but worth taking a look just to be sure.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth looking into. This definition came from the Meta service.

@atscott
Copy link
Contributor

atscott commented Apr 26, 2024

How common will it be to define metadata on routes? I'm wondering if the MetadataStrategy should be provided with a feature opt-in rather than having it there by default and not tree-shakeable. We can add a dev-mode check to the config validation that throws if the feature isn't provided but the metadata property is present.

@ngbot ngbot bot added this to the Backlog milestone Apr 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: router detected: feature PR contains a feature commit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants