angular/goldens/public-api/router
arturovt 7724a9460d refactor(router): replace Optional with inject() flags
Replace `@Optional() link: RouterLink` constructor parameter with
`link = inject(RouterLink, {optional: true})` to enable tree-shaking
of the `Optional` decorator and its factory scaffolding.

Bundle size reduction: `Optional` is a runtime value created by
`makeParamDecorator()`. Even in production builds, ESBuild and other
bundlers must keep their factory code because it is referenced via
`Optional`. With `inject()`, this class is no longer referenced,
allowing it and the `makeParamDecorator` scaffolding to be tree-shaken
when unused elsewhere.

Note: This updates the constructor signature but should not be
considered a breaking change. Angular's official guidance is that
directives, components, and pipes should be instantiated by the
framework, not by user code. Directly calling `new RouterLinkActive(...)`
is an unsupported pattern that goes against Angular's design principles.
2025-11-10 09:48:32 -08:00
..
testing feat(router): convert lastSuccessfulNavigation to signal (#63057) 2025-08-13 11:29:01 -07:00
upgrade refactor(core): remove unnecessary deps arrays (#63823) 2025-09-16 16:51:52 +00:00
errors.api.md fix(router): Surface parse errors in Router.parseUrl (#64503) 2025-10-20 17:51:29 +00:00
index.api.md refactor(router): replace Optional with inject() flags 2025-11-10 09:48:32 -08:00