Commit graph

24573 commits

Author SHA1 Message Date
Matt Shaffer
d721934dfa docs: update example file name (#46164)
PR Close #46164
2022-05-31 11:59:18 -07:00
Andrew Kushnir
b7394bf77f fix(core): include component name into unknown element/property error message (#46160)
This commit adds the component name into unknown element/property error message, so that it's easier to find a location of a template where the problem happened.

Closes #46080.

PR Close #46160
2022-05-27 11:45:48 -07:00
Pawel Kozlowski
12b4ec3d85 docs: create a dedicated page for the NG0203 error (#46166)
Adds a dedicated error page for NG0203 (injection context).

PR Close #46166
2022-05-27 10:15:55 -07:00
Pawel Kozlowski
6b52f03f5f fix(core): add more details to the MISSING_INJECTION_CONTEXT error (#46166)
The MISSING_INJECTION_CONTEXT runtime error can be thrown when the
inject function is used outside of the class creation context.
Before this change we've only used a vague terms of the
'injection context'. This commit extends the error message to
indicate that we really talk about the class construction context.

PR Close #46166
2022-05-27 10:15:55 -07:00
George Kalpakas
f87aa2da8c build(docs-infra): upgrade cli command docs sources to 874ad2184 (#46157)
Updating [angular#main](https://github.com/angular/angular/tree/main) from
[cli-builds#main](https://github.com/angular/cli-builds/tree/main).

##
Relevant changes in
[commit range](b71844f36...874ad2184):

**Modified**
- help/completion.json

PR Close #46157
2022-05-27 10:13:06 -07:00
Andrew Kushnir
a31d8218cc fix(core): update unknown property error to account for standalone components in AOT (#46159)
This commit updates the error message to use correct info depending on whether a component is standalone or not. Previously we were always referring to @NgModules as a place to fix the issue, but not we also mention @Component when needed (for standalone components).

PR Close #46159
2022-05-27 10:12:27 -07:00
dario-piotrowicz
2863dff7fa docs: change wrong alert to callout (#46145)
change the alert present in the lifecycicle-hook docs to a callout so
that its header can be properly rendered (since alters don't support have headers)

PR Close #46145
2022-05-27 09:30:22 -07:00
Ian Gregory
6a4353cb40 docs: close lightbox div to fix page display (#46155)
PR Close #46155
2022-05-26 17:42:52 -07:00
mgechev
bb16b1919a docs: fix incorrect title in the roadmap (#46140)
Ensure we're using h3 titles for consistency.

PR Close #46140
2022-05-26 17:42:24 -07:00
Alex Rickabaugh
f0bf29a24d fix(compiler-cli): preserve forwardRef for component scopes (#46139)
Angular generally supports cycles between components in the same NgModule.
We have a mechanism of moving the component scope declaration into the
NgModule file in this case. This ensures that Angular never itself
introduces an import which creates a cycle.

What happens if the cycle already exists in the user's program, though, is a
bit different. In these cases, the "correct" emit for Angular is to generate
the component scope (whether direct or remote) inside of a closure, to
prevent evaluating the scope's references until module evaluation is
complete and all cyclic imports have been resolved. We don't want to do this
for *all* scopes because the code size cost of emitting a function wrapper
is non-zero.

In this fix, we take the presence of a `forwardRef` in a component's
`imports` or in an NgModule `declarations` or `imports` as a sign that
component scopes emitted into those files need to be protected against
cyclic references. In a future commit, we may introduce a warning or error
if cyclic imports are not protected behind `forwardRef` in these cases, but
this will take some time to implement.

PR Close #46139
2022-05-26 17:42:01 -07:00
George Kalpakas
3fdcf991c7 build(docs-infra): be able to resolve root-relative image URLs in getImageDimensions() (#46138)
Previously, `getImageDimensions()` would try to resolve image URLs
relative to the base path using `path.resolve()`. This resulted in
root-relative URLs (i.e. URLs starting with `/`) being treated as
absolute filesystem paths and thus resolving incorrectly
([example failure][1]).

This commit fixes it by using `.join()` instead, which is more
appropriate in this case. (Originally discussed [here][2].)

[1]: https://circleci.com/gh/angular/angular/1173150
[2]: https://github.com/angular/angular/pull/46134#issuecomment-1137191996

PR Close #46138
2022-05-26 11:25:07 -07:00
Andrew Kushnir
bd6d82bcb7 fix(core): better error message when unknown property is present (#46147)
Prior to this commit, the error message that was produced for the unknown property situation, din't contain extra info on how the problem can be fixed. This commit adds more info to the error message and makes it similar to the one we use during the AOT compilation.

PR Close #46147
2022-05-26 11:24:47 -07:00
Alex Rickabaugh
cc0f38130b docs: release notes for the v14.0.0-rc.2 release (#46144)
PR Close #46144
2022-05-25 14:37:39 -07:00
Alex Rickabaugh
155c289797 docs: release notes for the v13.3.10 release (#46142)
PR Close #46142
2022-05-25 13:43:01 -07:00
dario-piotrowicz
a1e5aad5dc fix(core): improve TestBed declarations standalone error message (#45999)
improve the error message developers get when adding a standalone
component in the TestBed.configureTestingModule's declarations array,
by making more clear the fact that this error originated from the
TestBed call

resolves #45923

PR Close #45999
2022-05-25 12:20:52 -07:00
Renovate Bot
d2ea1ba876 build: update angular (#46120)
PR Close #46120
2022-05-25 12:18:05 -07:00
Kristiyan Kostadinov
1cc158375b build: update to TypeScript 4.7 final (#46132)
Bumps up the repo to the final version of TypeScript 4.7. Also updates AIO to 4.7.

PR Close #46132
2022-05-25 11:37:12 -07:00
dario-piotrowicz
7c6b740b97 docs: fix … presented in aio code docs (#46123)
the symbol `…` displays correctly in code-example blocks and in
plain html text, it does however not work correctly for code espressed
using backticks, fix such occurrences by replacing `…` with `...`

PR Close #46123
2022-05-25 11:30:30 -07:00
mgechev
8db9930aa0 docs: update the Angular roadmap as of May 2022 (#46117)
* Update project completion status
* Update project description based on state
* Add new projects to the future section

PR Close #46117
2022-05-25 11:23:53 -07:00
dario-piotrowicz
8629f2d0af refactor(compiler-cli): fix "for to" typo in code comment (#46113)
fix the typo/extra for in a code comment saying
"this is used for to determine" so that it only says
"this is used to determine"

PR Close #46113
2022-05-24 10:52:17 -07:00
dario-piotrowicz
9ed50ad36f docs: replace wrong hyphen with # in aio cheatsheet (#46125)
replace the hyphen symbol wrongly used in the aio cheatsheet
doc to create a template variable with the proper # symbol

PR Close #46125
2022-05-24 10:49:52 -07:00
Roopesh Chinnakampalli
983aa233cf docs: corrected the misspelled word (#46126)
innovation -> invocation
PR Close #46126
2022-05-24 10:47:46 -07:00
David Schmidt
bd94c076c7 docs: fix FormRecord example (#46124)
PR Close #46124
2022-05-24 10:47:07 -07:00
Aristeidis Bampakos
0b6ca5b807 docs: align lightbox elements together (#46107)
Align lightbox `div` elements so that the image appears inside the lightbox correctly.

PR Close #46107
2022-05-24 10:45:52 -07:00
Andrew Scott
53ca936366 feat(router): Add ability to create UrlTree from any ActivatedRouteSnapshot (#45877)
This exposes a new function from the router public API that allows
developers to create a `UrlTree` from _any_ `ActivatedRouteSnapshot`.
The current Router APIs only support creating a `UrlTree` from an
`ActivatedRoute` which is both active _and_ materially appears in the
`UrlTree` (it cannot be an empty path named outlet). This is because the
implementation of the current way of creating a `UrlTree` attempts to
look up the `UrlSegment` of the `ActivatedRoute` in the currently active
`UrlTree` of the router. When this doesn't work, the `UrlTree` creation
fails.

Note that this API does not replace the current one. That would actually be a
breaking change but should be done at some point in the future (v15). That is,
`router.navigate` should call this new function. At that point, we can
remove `_lastPathIndex`, `_urlSegment`, and `_correctedPathIndex` from
the `ActivatedRoute`, along with all of the logic associated with
determining what those should be. In addition, this would unblock a fix
for #26081 because the `applyRedirects` and `recognize` operations
could be combined into one.  Overall, this would simplify logic in the router
and reduce code size. It also exposes core routing capabilities as a helper function
which were previously private API, which is a necessary step towards #42953.

As a stress test for this new function, it _was_ swapped in as the
default for `UrlTree` creation in #45859 and tested internally. The
results indicate that this function behaves correctly.

resolves #42191 (Tested directly)
resolves #38276 (The test with a guard covers this case)
resolves #22763 (Tested directly)

PR Close #45877
2022-05-24 10:40:24 -07:00
Jan Kuehle
7efa09b401 perf(bazel): use allowedInputs to avoid fs.stat (#46069)
Call tsc_wrapped's fileExists function instead of TypeScript's.

tsc_wrapped (used internally by ngc-wrapped) has an optimization under
bazel to avoid file system calls where possible. It takes advantage
bazelOpts.allowedInputs, which contains a list of all files available
for compilation.

File system calls can be quite slow depending on the file system. In
google3 I saw a 38 seconds compilation, which spent 6 seconds just doing
fs.stat calls during module resolution. Those fs.stat calls are entirely
gone after with this change.

PR Close #46069
2022-05-24 10:39:17 -07:00
mariu
c3205d0962 feat(devtools): Create browser specific styles for chrome and firefox (#46037)
Create browser specific styles for chrome and firefox

PR Close #46037
2022-05-23 14:00:10 -07:00
dario-piotrowicz
f04a8ead18 docs: move all bazel testing info to a single location (#46084)
instead of presenting the same (or similar information) in both the
DEVELOPER.md and the BAZEL.md files, more all the information in the
BAZEL file and refer to that section in the DEVELOPER file

PR Close #46084
2022-05-23 13:59:05 -07:00
dario-piotrowicz
390e9896d3 docs: update directives info to include standalone (#46078)
update the directives api doc to inform developers that
directives can also be declared as standalone

PR Close #46078
2022-05-23 13:54:11 -07:00
A. J. Javier
281d4b7ace docs: fix angularfire2 hyperlink (#46046)
PR Close #46046
2022-05-23 13:52:11 -07:00
JoostK
e592cc7c1c refactor(compiler-cli): report better error when a ModuleWithProviders call occurs within Component.imports (#46009)
This commit improves the reported error when importing e.g. `RouterModule.forRoot()`
from within `Component.imports`. Such import is not supported, as standalone components
can only refer to other standalone entities or NgModules in their `imports` array;
`ModuleWithProviders` are not supported as `Component.imports` is meant to be used
for the compilation scope of the component, _not_ for configuring DI.

Closes #46003

PR Close #46009
2022-05-23 13:50:05 -07:00
JoostK
3d19f32942 refactor(compiler-cli): extract ModuleWithProviders analysis out of NgModule handler (#46009)
This commit moves the foreign function resolver logic for detecting a
`ModuleWithProviders` in a return type position of a function call, as the logic can
then be reused for standalone components in a subsequent commit.

PR Close #46009
2022-05-23 13:50:05 -07:00
dario-piotrowicz
a99f2eb38d feat(docs-infra): add group role and label for aio-notification (#45770)
add a role and an aria-label to the aio-notification component so that
it can be handled better by assistive technologies

resolves #44345

PR Close #45770
2022-05-23 13:48:28 -07:00
dario-piotrowicz
c8086b7e86 docs: make structural directives guide generic (#44895)
tweak the current structural directives guide (currently mainly targeted
at the creation of custom structural directives) so that is more generic
and a point of reference for structural directives in general

this also includes the re-addition of the one-per-element section
removed in PR #40015

resolves #44786

PR Close #44895
2022-05-23 13:44:41 -07:00
Aristeidis Bampakos
30427135ce docs: remove broken code from TOH tutorial (#46105)
At the end of Part 2 of the Tour or Heroes tutorial, there is a code sample that is broken. It looks like it was added by mistake because it is not related to the summary.
PR Close #46105
2022-05-23 13:31:23 -07:00
Paul Gschwendtner
91070d9512 ci: fix formatting for babel_ast_host.ts file after recent changes (#46082)
The formatting of the `babel_ast_host.ts` file is invalid due to a
recently-merged PR. The PR had a passing `lint` state but this seemed
to just appear like this because the Git comparison range on upstream
branches can become invalid (due to a known bug in CircleCI -- reported)

PR Close #46082
2022-05-23 13:30:38 -07:00
dario-piotrowicz
a43385cca4 docs: add standalone details to NG8001 (#46079)
improve the degubbing section of the NG8001 error by including details
about standalone components

PR Close #46079
2022-05-23 13:28:48 -07:00
Tom Raithel
551671fd51 docs: fix division by zero in progress events example (#46077)
If the `event.total` is undefined, this line would have generated a `NaN` due to division by zero. I suppose, that a `0` would be more suitable for this case.

PR Close #46077
2022-05-23 13:27:45 -07:00
Paul Gschwendtner
0bb8c48ae7 build: fix unbound variable error in build artifact script (#46076)
We recently had a couple of issues with the shallowing of snapshot
git repositories. In an attempt to fix this, parts of the publish
script of the COMP repo have been used, but variables have not been
updated properly.

This commit fixes an unbound variable, avoiding errors when snapshots
are published for a new branch (e.g. when we branch-off).

PR Close #46076
2022-05-23 13:26:32 -07:00
Nathan Nontell
8461259334 docs(docs-infra): update createComponent description to fix incorrect method name and invalid use of html escaping (#46074)
PR Close #46074
2022-05-23 13:21:45 -07:00
George Kalpakas
f83ee69e17 build(docs-infra): update Angular Material to v14.0.0-rc.0 in AIO (#45997)
Update angular.io to the latest prerelease version of Angular Material
(v14.0.0-rc.0).

PR Close #45997
2022-05-23 13:20:10 -07:00
George Kalpakas
c9e5b5b5c0 build(docs-infra): update Angular CLI/framework to v14.0.0-rc.0 in AIO (#45997)
Update angular.io to the latest prerelease versions of Angular CLI and
framework (v14.0.0-rc.0).

Also update angular.io to more closely align with new CLI apps. See also
the [diff][1] between a basic v13.0.0-next.9 CLI app and a v14.0.0-rc.0
one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/13.0.0-next.9...14.0.0-rc.0

PR Close #45997
2022-05-23 13:20:10 -07:00
George Kalpakas
8d4dcbcccc build(docs-infra): update AIO payload sizes (#45997)
Update the AIO payload sizes to better see the impact in size of changes
in subsequent commits.

PR Close #45997
2022-05-23 13:20:10 -07:00
George Kalpakas
67ec9eec64 build(docs-infra): update Angular CLI/framework to v14.0.0-rc.0 in docs examples (#45997)
Update the docs examples to the latest prerelease versions of Angular
CLI and framework (v14.0.0-rc.0).

Also update the example apps to more closely align with new CLI apps.
See also the [diff][1] between a basic v13.0.0-rc.3 CLI app and a
v14.0.0-rc.0 one.

[1]: https://github.com/cexbrayat/angular-cli-diff/compare/13.0.0-rc.3...14.0.0-rc.0

PR Close #45997
2022-05-23 13:20:10 -07:00
dario-piotrowicz
18b0ee073f fix(compiler-cli): update unknown tag error for aot standalone components (#45919)
update the error message presented during aot compilation when an unrecognized
tag/element is found in a standalone component so that it does not mention
the ngModule anymore

Note: the jit variant is present in PR #45920

resolves #45818

PR Close #45919
2022-05-23 13:18:49 -07:00
Jerome Kruse
e235c70d7d docs: update service-worker-config to more clearly describe behavior (#45909)
Fixes #45280

PR Close #45909
2022-05-23 13:17:51 -07:00
Andrew Kushnir
985f8d721e fix(core): produce proper error message for unknown props on <ng-template>s (#46068)
Currently for cases when an unknown structural directive is applied to `<ng-template>`s, an error message thrown by the framework doesn't contain a tag name, for example:

```
NG0303: Can't bind to 'unknownDir' since it isn't a known property of 'null'.
```

The underlying reason is that the tag name for the `<ng-template>` is not produced (`null` is useed as a value) by the compiler in case of inline templates and runtime logic relies on this effect.

This commit handles this situation when an error message is thrown, as the fastest way to improve the error message. More refactoring would be needed to avoid relying on the mentioned effect at runtime.

PR Close #46068
2022-05-23 10:03:23 -07:00
Thomas Mair
863c32e8c9 fix(docs-infra): add member name to search index without ignore list (#46060)
Previously classs, interface and enum members where filtered with the default word ignore list. This lead to  poor search results if a search for a member on the ignore list was performed.

PR Close #46060
2022-05-23 09:56:08 -07:00
J Rob Gant
1bd0532e87 docs: Remove outdated note (#46022)
Component.styles can now use SCSS or LESS preprocessors.

PR Close #46022
2022-05-23 09:53:40 -07:00
Doug Parker
23a9990935 docs: add demo video for Angular CLI autocompletion doc (#45995)
The CLI autocompletion doc added in https://github.com/angular/angular-cli/pull/23146 includes a demo GIF, but AIO currently has no infrastructure to pull assets like images from the CLI repository, so this demo needs to be stored directly in AIO on this repository.

PR Close #45995
2022-05-23 09:30:44 -07:00