Commit graph

29561 commits

Author SHA1 Message Date
Andrew Scott
d9f550c97f refactor(router): Refactor loaded config to track injectors rather than NgModuleRef (#45593)
The `Injector` is really the piece of information that the `Router` is
interested in keeping track of. Storing the `NgModuleRef` is somewhat
confusing based on how it's used later on. `RouterOutlet` uses it for the
`componentFactoryResolver`, but this is not needed anymore (and deprecated). In
fact, we can get back to the `NgModuleRef` anyways using the injector.
For now, that's what this change does. A different refactor will remove
the use of the `componentFactoryResolver` altogether.

Additionally, in the standalone world, we plan to implement a feature to
allow defining `providers` directly on the `Route`. This means there
won't be an associated `NgModuleRef` so this refactor prepares for that
feature.

PR Close #45593
2022-04-18 09:52:56 -07:00
Alex Rickabaugh
3578e94384 refactor(core): internally support providedIn: environment (#45626)
This commit adds a new internal scope to `R3Injector` for
`EnvironmentInjector`s specifically. This will allow us to scope services to
the environment side of the injector hierarchy specifically, as opposed to
the `'any'` scope which also includes view-side injectors created via
`Injector.create`. For now, this functionality is not exposed publicly, but
is available to use within `@angular/core` only.

PR Close #45626
2022-04-18 09:28:43 -07:00
Alex Rickabaugh
d5a6cd1111 feat(core): implement EnvironmentInjector with adapter to NgModuleRef (#45626)
This commit exposes a new `EnvironmentInjector` abstraction, which
generalizes the "module injector" concept to injectors that are not based on
NgModules.

An EnvironmentInjector is a conceptual analogue of an `NgModuleRef` - it
represents an injector on the former "module" DI hierarchy in Angular (now
renamed to the "environment injector hierarchy"). Environment injectors are
created via the `createEnvironmentInjector` function from a list of
`Provider`s.

For backwards compatibility with current code using `NgModuleRef`,
`EnvironmentInjector`s are wrapped by an adapter `NgModuleRef`
implementation, so injecting `NgModuleRef` always returns the latest
`EnvironmentInjector`, even if that injector was not based on an NgModule.
Conversely, NgModule-based `NgModuleRef`s created via `createNgModuleRef`
are _also_ `EnvironmentInjector`s.

PR Close #45626
2022-04-18 09:28:42 -07:00
Andrew Kushnir
b568a5e708 feat(core): implement importProvidersFrom function (#45626)
This commit implements the `importProvidersFrom` function that allows
extracting a list of `Provider`s from a list of NgModule types. The
R3Injector which implements DI at the "module" level for Angular is
refactored to use this functionality under the hood.

This commit also implements `INJECTOR_INITIALIZER`, a DI multi-provider
token which is used to run initialization logic when an injector is created.

PR Close #45626
2022-04-18 09:28:42 -07:00
Alex Rickabaugh
a5a7fbc173 test(core): fix a crosstalk issue with locale ids (#45626)
Previously there was a test ordering issue with the application_module_spec
tests where the value of `getLocaleId()` depended on the order in which
tests ran. Specifically, `setLocaleId()` lower-cases the current locale ID,
so the measured value in a test depended on whether a previous test had
called `setLocaleId()` (the difference between 'en-US' and 'en-us').

PR Close #45626
2022-04-18 09:28:42 -07:00
Doug Parker
1fe255c76f refactor(compiler): add original_code to goog.getMsg() options (#45606)
This links back each placeholder in a message to the original Angular template span which defines its expression. This is useful for understanding where each placeholder comes from in the context of the full message.

PR Close #45606
2022-04-18 09:26:16 -07:00
Andrew Kushnir
8c83f12daa ci: add more reviewers to the docs-packaging-and-releasing group (#45652)
Currently that group has just 2 reviewers, but we often update the files that belong to that group during the deprecation period. Adding more people would allow to balance the reviews better.

PR Close #45652
2022-04-18 09:24:57 -07:00
Kristiyan Kostadinov
57f8ab2ed8 fix(core): better error message when directive extends a component (#45658)
We throw an error when a directive is trying to extend a component, but we don't actually say which class is responsible which can be difficult to track down. These changes add the two class names to the error message.

PR Close #45658
2022-04-18 09:24:23 -07:00
Kristiyan Kostadinov
b29b95b0f8 fix(devtools): clean up menu layout (#45665)
The menus weren't using the `mat-menu` component correctly which had led to some inconsistent spacing and the need for style overrides. These changes correctly wrap the menu content in `mat-menu-item` which has the added benefit of having keyboard support. I had to keep some of the overrides in order to preserve the dense layout of the menus.

I've also cleaned up the component by:
* Removing some unnecessary styles.
* Switching single-class usages of `ngClass` to `class.` bindings.
* Not using `br` tags for spacing.

PR Close #45665
2022-04-18 09:23:13 -07:00
Renovate Bot
68357104c9 build: lock file maintenance (#45457)
PR Close #45457
2022-04-15 14:38:16 -07:00
dario-piotrowicz
0b6407241c fix(docs-infra): fix aio search-results issue with toolbar and notification (#45579)
use border-top-width instead of padding-top as the strategy for moving
the search-results panel down, this fixes the issue of the panel going
behind the toolbar (which causes either overlapping text in the home
page or the results scrollbar to be hidden behind the toolbar in other
pages)

PR Close #45579
2022-04-15 14:22:14 -07:00
dario-piotrowicz
9e69579440 fix(docs-infra): amend notification close button aria-label (#45579)
move the aria-label used inside the close-button to the button itself
(since otherwise the button's aria-label overrides the childs)

PR Close #45579
2022-04-15 14:22:14 -07:00
dario-piotrowicz
d2436bfc91 feat(docs-infra): add close button to search-results aio panel (#45579)
add a close button to the search-results aio panel so that the user can
conveniently close it via keyboard

this complements the focus trap implemented in PR #44989
(more here: https://github.com/angular/angular/pull/44989#issuecomment-1037287678)

PR Close #45579
2022-04-15 14:22:13 -07:00
ivanwonder
f57e46c538 fix(language-service): two-way binding completion should not remove the trailing quote (#45582)
We allow the path to contain both the `t.BoundAttribute` and `t.BoundEvent` for two-way
bindings but do not want the path to contain both the `t.BoundAttribute` with its
children when the position is in the value span because we would then logically create a path
that also contains the `PropertyWrite` from the `t.BoundEvent`. This early return condition
ensures we target just `t.BoundAttribute` for this case and exclude `t.BoundEvent` children.

Fixes https://github.com/angular/vscode-ng-language-service/issues/1626

PR Close #45582
2022-04-15 13:53:48 -07:00
Andrew Kushnir
c6e0e3f6d3 fix(core): improve multiple components match error (#45645)
This commit improves the error message that is thrown at runtime when multiple components match the same element. Now the error message contains names of classes that represent those components.

PR Close #45645
2022-04-15 13:52:19 -07:00
Andrew Kushnir
2e973121ba test(core): add a test for multiple named interpolations with the same name (#45651)
The test from this commit verifies that i18n logic can handle multiple named interpolations with the same name.

PR Close #45651
2022-04-15 13:51:55 -07:00
Andrew Scott
96fd29c6d2 fix(router): validate lazy loaded configs (#45526)
Lazy loaded configs are not validated at runtime like the initial set of
routes are. This change also validates lazy loaded configs right after
they're loaded.

BREAKING CHANGE: Lazy loaded configs are now also validated once loaded like the
initial set of routes are. Lazy loaded modules which have invalid Route
configs will now error. Note that this is only done in dev mode so
there is no production impact of this change.

Fixes #25431

PR Close #45526
2022-04-15 12:30:44 -07:00
Dmitrij Kuba
f13295f3a3 perf(router): cancel the navigation instantly if at least one resolver doesn't emit any value (#45621)
Recently the navigation was on hold even at least one resolver didn't emit any value and completed, but another ones still are in progress to resolve any value. The changes cancel the navigation instantly if at least one resolver doesn't emit any value and completed.

PR Close #45621
2022-04-15 10:06:26 -07:00
Renovate Bot
770ea926bf build: update dependency @microsoft/api-extractor to v7.22.2 (#45641)
PR Close #45641
2022-04-15 09:27:39 -07:00
Ilya Marchik
b5b0a50294 docs: fix typo (#45637)
Replace wrong mention of 'heroService.delete()' with 'heroService.deleteHero()' because 'heroService.delete()' doesn't exist and 'heroService.deleteHero()' should be mentioned instead

Resolves #45636

PR Close #45637
2022-04-14 16:30:03 -07:00
Renovate Bot
7d2a619812 build: update all non-major dependencies (#45632)
PR Close #45632
2022-04-14 15:02:45 -07:00
Andrew Kushnir
6444a02620 docs: move old changelog entries to a separate file (#45638)
This commit moves all release notes for everything before v11.0.0 to a separate file, so that the changelog can be rendered correctly via GitHub UI.

Closes #45635.

PR Close #45638
2022-04-14 15:01:21 -07:00
George Kalpakas
2f08b8043e build(docs-infra): upgrade cli command docs sources to 5bd17a256 (#45630)
Updating [angular#master](https://github.com/angular/angular/tree/master) from
[cli-builds#master](https://github.com/angular/cli-builds/tree/master).

##
Relevant changes in
[commit range](0e8f3c34b...5bd17a256):

**Added**
- help/completion.json

PR Close #45630
2022-04-14 15:00:40 -07:00
George Kalpakas
94fba9b047 docs(core): fix typo in View Encapsulation code example (#45629)
Fix closing tag name to match opening one (`</hero-detail>` -->
`<hero-details>`).

PR Close #45629
2022-04-14 15:00:04 -07:00
Dylan Hunn
e0a2248b32 feat(forms): Add a FormRecord type. (#45607)
As part of the typed forms RFC, we proposed the creation of a new FormRecord type, to support dynamic groups with homogenous values. This PR introduces FormRecord, as a subclass of FormGroup.

PR Close #45607
2022-04-14 14:59:10 -07:00
Paul Gschwendtner
f8a1ea0c11 fix(bazel): do not error if files part of srcs are outside of package (#45622)
We recently refactored how the ng package rule deals with static files.
As part of this refactoring, transitive files outside of the current
Bazel package were flagged as errors, while previously this was just
ignored. We need to revert back this behavior (even though code remains
much simpler and predicable now) since sass library targets for example
reference all transtive files in the default info and break packages then

PR Close #45622
2022-04-14 14:58:27 -07:00
Andrew Scott
000363eec5 refactor(router): combine functions for getting loaded config (#45613)
There are two functions which do the same thing and are meant to search
for the closest loaded config in the `ActivatedRouteSnapshot` parent
tree. These can be combined to reduce code duplication.

One difference in the current implementation is the early exit for the
implementation in `activate_routes` when `route.component` is defined.
This early exit takes advantage of the fact that the component must then
also have a `RouterOutlet`, which injects `ComponentFactoryResolver`,
which would end up being the same one as what would be found if we
continued to look up the parent tree. This is only a tiny optimization
that will actually break when we add `providers` as a feature to the
`Route` config. In this scenario, we _must_ find the correct injector
in the parent routes and cannot rely on a parent `RouterOutlet` since
there may be some route with a providers list in between.

PR Close #45613
2022-04-13 17:29:42 -07:00
Andrew Kushnir
e250db4f26 refactor(core): avoid referencing PlatformRef in bootstrap code (#45519)
This commit updates an existing bootstrap logic to avoid referencing the `PlatformRef` instance to keep track of the platform status. Instead, we use platform injector, so that the `PlatformRef`can be tree-shaken away in the bootstrap logic for Standalone Components.

The motivation for this change is that retaining the `PlatformRef` class also retains NgModule-based bootstrap code, which would not be needed in case of Standalone Components.

PR Close #45519
2022-04-13 15:34:46 -07:00
Jessica Janiuk
fbbed3d723
release: cut the v14.0.0-next.13 release (#45616) 2022-04-13 11:40:40 -07:00
Jessica Janiuk
0f8e181a35
docs: release notes for the v13.3.3 release (#45615) 2022-04-13 11:37:13 -07:00
Andrew Scott
47e7a2850b refactor(router): Add warning for relativeLinkResolution: 'legacy' (#45523)
This change adds code to compute the corrected value for a link,
regardless of the `relativeLinkResolution` value. Then, if the
`relativeLinkResolution` is set to `legacy` and differs from the correct
value, a warning is printed to the console in dev mode.

This change is meant to assist in notifying developers that they have
code which relies on the deprecated, broken behavior so they can fix and
update the code before the `relativeLinkResolution` option is fully
removed.

PR Close #45523
2022-04-13 17:19:08 +00:00
Kristiyan Kostadinov
598b759d33 fix(compiler): avoid errors with extremely long instruction chains (#45574)
Our logic for generating code from an AST uses recursion which limits the number of expressions we can nest before we reach the call stack limit. These changes add a limit in order to avoid errors in some cases where the chains become extremely long.

Fixes #45564.

PR Close #45574
2022-04-13 16:18:55 +00:00
Renovate Bot
7bf1cf4bf5 build: update all non-major dependencies (#45493)
PR Close #45493
2022-04-13 15:33:33 +00:00
4javier
a6ab3f7beb docs: fix grammar (#45455)
PR Close #45455
2022-04-12 23:55:32 +00:00
4javier
9e86a3134e docs: fix to comply with new codeblock guidelines (#45455)
PR Close #45455
2022-04-12 23:55:32 +00:00
4javier
062fa76707 docs: modified as per dylhunn suggestions (#45455)
https://github.com/angular/angular/pull/45455#pullrequestreview-925369970
PR Close #45455
2022-04-12 23:55:32 +00:00
4javier
b9e7983606 docs: update template reference variables (#45455)
- Specify `NgForm` gets applied by default on `<form>` elements before the long example using it
- Move the strange (and questioned in a commented line) snippet about undefined ref vars in a standalone paragraph and clarify its meanings (adding the part about directive just because there was something similar already there)
- Extend and modify `*ngFor` example, since in the original that was misleading to think reference variable couldn't be used inside a loop
- Remove two lines stating that with `*ngIf` and `*ngFor` the framework cannot know if a template is ever instantiated (can't see how this relate with the page)
- Add an explanation of assignment of default `$implicit` value to undefined input variables
- Modify template example for template input variable to be a complete ngForOf loop instead of the original poor intelligible truncated one
- Replace last generic statements about variable namespaces with a more pragmatic and explanatory one concerning the resolution in case of homonymy

PR Close #45455
2022-04-12 23:55:32 +00:00
Andrew Kushnir
9add714b13 refactor(core): remove deprecated aotSummaries fields in TestBed config (#45487)
BREAKING CHANGE:

Since Ivy, TestBed doesn't use AOT summaries. The `aotSummaries` fields in TestBed APIs were present, but unused. The fields were deprecated in previous major version and in v14 those fields are removed. The `aotSummaries` fields were completely unused, so you can just drop them from the TestBed APIs usage.

PR Close #45487
2022-04-12 23:29:38 +00:00
Andrew Kushnir
89ed8d8976 refactor(core): make ComponentFactoryResolver lazily instantiated in ApplicationRef (#45507)
This commit removes the `ComponentFactoryResolver` as a constructor argument of the `ApplicationRef` class. This makes it lazily instantiated + simplifies further refactoring in a context of Standalone Components.

PR Close #45507
2022-04-12 22:29:17 +00:00
Andrew Kushnir
f38c344174 refactor(core): make platform core providers tree-shakable (#45506)
This commit refactors the set of hardcoded platform core providers into tree-shakable providers.
In addition to making them tree-shakable, this would also avoid the need to rely on the platform creation logic in an upcoming bootstrap logic for Standalone Components.

PR Close #45506
2022-04-12 22:28:23 +00:00
Jason Hendee
3c1695e399 docs: make tutorial instructions consistent (#45372)
When starting this tutorial, it's not clear to the user whether they should add routing right away, Etc. The other tutorials within the routing section do a better job of this.

Also.. the suggested name of this sample app clashes with that of a previous tutorial, forcing the user to either delete the previous tutorial files, choose a different name for this tutorial's app, or place this app in a different parent directory.
 Conflicts:
	aio/content/guide/router-tutorial-toh.md

PR Close #45372
2022-04-12 22:27:37 +00:00
Dylan Hunn
8d7351d939 build: only allow renovate to run on Monday nights (#45605)
By running renovate once a week, we can consolidate all the updates into a single weekly PR, before each Wednesday release. That will significantly reduce the burden on caretakers, and make patch ports less onerous.

PR Close #45605
2022-04-12 22:26:48 +00:00
Michal Materowski
663d477cb0 refactor(core): remove duplicated code in change_detection_util (#45599)
Removes duplicated code in change_detection_util and reorganizes imports to use utils module.

PR Close #45599
2022-04-12 22:26:09 +00:00
Renovate Bot
820077df76 build: update dependency glob to v8 (#45598)
PR Close #45598
2022-04-12 22:02:26 +00:00
Virginia Dooley
83920af7cd docs: new Pipes custom data doc (#45505)
PR Close #45505
2022-04-12 21:29:06 +00:00
Virginia Dooley
0d6325b53c docs: pipes custom data transform (#45505)
PR Close #45505
2022-04-12 21:29:06 +00:00
4javier
ee3cfc8815 docs: fix path typo (#45604)
PR Close #45604
2022-04-12 21:27:49 +00:00
4javier
0528b47728 docs: fix final code review section codetabs path (#45604)
Fix paths for codetabs in final review section messed up by this commit 42289f25c6
They were all pointing to `heroes-search.component`
PR Close #45604
2022-04-12 21:27:49 +00:00
Michael-Doner
79de026a20 docs: add powershell execution policies note (#45576)
Fixes #44598

PR Close #45576
2022-04-12 21:13:59 +00:00
Dylan Hunn
65323286ed release: cut the v14.0.0-next.12 release (#45603)
PR Close #45603
2022-04-12 13:00:50 -07:00