20612 Commits

Author SHA1 Message Date
Pete Bacon Darwin 345f5c487a fix(core): handle multiple i18n attributes with expression bindings (#41912)
When there are multiple attributes that are marked for i18n translation,
which contain expression bindings, we were generating i18n update op-codes
that did not accurately map to the correct value to be bound in the lView.
Each attribute's bindings were relative to the start of the lView first
attributes values rather than to their own.

This fix passes the current binding index to `generateBindingUpdateOpCodes()`
when processing i18n attributes to account for this.

Fixes #41869

PR Close #41912
2021-05-03 10:03:31 -07:00
Mikhail ee860366c9 docs(forms): reduce ambiguity in forms data flow wording (#41900)
PR Close #41900
2021-05-03 10:01:15 -07:00
Gopal Jayaraman ae0fa0885e fix(common): add right ContentType for boolean values with HttpClient request body(#38924) (#41885)
currently a boolean as body is seen as text/plain, where is should be seen as application/json, since it is valid JSON, like numbers.

PR Close #41885
2021-05-03 10:00:18 -07:00
Mathias Schäfer 7e9ef4d257 docs: Update link to Testing Angular online book (#41906)
The book has moved to a its own domain.
PR Close #41906
2021-04-30 14:34:49 -07:00
Igor Minar 6b5f15528c fix(docs-infra): switch over to img[loading=lazy] for front page images (#34900)
This should speed up the perceived loading latency as the image loading won't block rendering.

https://addyosmani.com/blog/lazy-loading/

PR Close #34900
2021-04-30 14:16:24 -07:00
JoostK a58562a515 fix(animations): ensure consistent transition namespace ordering (#19854)
When including a component in a template, the component's host element
is immediately appended as child of the parent node upon creation.
Hence, `hostElement.parentNode` will be a valid reference. However, if
the parent component is being inserted as an embedded view—through
`ngIf` for example—then the parent's node itself will not have been
inserted yet. This means that we cannot properly determine the position
of the transition namespace, as any `containsElement` check will return
false given that the partial DOM tree has not been inserted yet, even
though it will be contained within an existing transition namespace once
the partial tree is attached.

This commit fixes the issue by not just looking at the existence of a
parent node, but rather a more extensive check using the driver's
`containsElement` method.

PR Close #19854
2021-04-30 14:15:48 -07:00
Wojciech Okoński 5bae16da48 docs(docs-infra): fix handling of client-side errors in networking (#36608)
Previously example for handling client-side errors in networking didn't work when there was no Internet connection.
Caught error is ProgressEvent in such case, not ErrorEvent and error.error.message is undefined.

PR Close #36608
2021-04-29 13:51:43 -07:00
Andrew Kushnir aea67e9724 ci: changes to packages/common/http should not require fw-common approval (#41887)
Currently when the change is made to the code inside the `packages/common/http` folder, both `fw-http` and `fw-common` group members are assigned for review. However only `fw-http` is required and should be sufficient. This commit updates the PullApprove config to exclude `packages/common/http` path from the list of folders that `fw-common` "owns".

PR Close #41887
2021-04-29 13:49:38 -07:00
Alan Agius 6ba592107d ci: only run publish_snapshot when not PR (#41877)
Currently, the non forked PRs such as Renovate will run `publish_snapshot` because `CIRCLE_PR_NUMBER` is not defined for PRs which are opened from non forked repos. Instead we add a filter to only run `publish_snapshot` on releasable branches.

Example of run were the mentioned variable is not defined https://app.circleci.com/pipelines/github/angular/angular/32093/workflows/7c8c4cfc-e6f6-44fc-a6dc-a82a6ac862db/jobs/976611

PR Close #41877
2021-04-29 10:16:04 -07:00
George Kalpakas 579c9f66b7 build: update remark packages (#41721) (#41862)
This commit updates the `remark` packages to v12 instead of the latest
(v13), because v13 is a major breaking change that requires more
investigation and work.

More specifically, v13 replaces the internals of `remark` with a new
CommonMark-compliant parser. (See their [release notes][1] for more
info.)

This change causes our old `remark` plugins (in [renderMarkdown.js][2])
to stop working.

[1]: https://github.com/remarkjs/remark/releases/tag/13.0.0
[2]: https://github.com/angular/angular/blob/d42019d4128ca0d9f233a085bfe838f93f8d0412/aio/tools/transforms/remark-package/services/renderMarkdown.js#L17-L24

PR Close #41721

PR Close #41862
2021-04-29 10:06:26 -07:00
Sam Severance 6aa61d540f docs: correct toh router tutorial (#41859)
* `SelectivePreloadingStrategyService` is already provided in the root
   module, so it should not be added to `AppRoutingModule` providers
   array

PR Close #41859
2021-04-29 10:05:31 -07:00
Teri Glover ecf9a12ce4 docs: Edits to remove jargon (#41536)
PR Close #41536
2021-04-28 15:11:33 -07:00
Keen Yee Liau fca8d7ae92 docs: remove tslint, codelyzer & protractor from dev deps (#41826)
TSLint and Codelyzer were deprecated in v11.
Protractor is no longer installed by default in new projects in v12.

PR Close #41826
2021-04-28 14:33:12 -07:00
Kapunahele Wong 3aa6d8fd90 docs: imrpove accessibility of lifecycle hooks example (#41071)
PR Close #41071
2021-04-28 14:26:35 -07:00
Cosmin Ababei f555a557a3 docs: remove mention of scheduleTick in markForCheck (#41845)
markForCheck doesn't call scheduleTick, thus I removed the comment which mentioned this.
PR Close #41845
2021-04-28 12:34:50 -07:00
Jessica Janiuk f550742020 release: cut the v11.2.12 release 11.2.12 2021-04-28 11:18:38 -07:00
Jessica Janiuk 336fe9124e Revert "ci: re-enable the @angular/components unit tests (#41816)" (#41863)
This reverts commit 3eaa1e473d.

PR Close #41863
2021-04-28 10:39:33 -07:00
George Kalpakas 3eaa1e473d ci: re-enable the @angular/components unit tests (#41816)
Previously, the `components-repo-unit-tests` CI job was temporarily
disabled due to a version mismatch between the `rules_nodejs`
dependency version on the two repos (angular/angular and
angular/components).

Now that both repos have been updated to a `rules_nodejs` version
>=2.0.0, we can re-enable the job and have `@angular/components` unit
tests run on every build.

PR Close #41816
2021-04-28 09:57:49 -07:00
George Kalpakas 7219d1b562 ci: prevent CI cache from growing indefinitely (#41814) (#41855)
Previously, the fallback key used for the CircleCI cache could match a
cache indefinitely (as long as `.bazelversion` didn't change). This
would allow the cache to grow quite large, which in turn would lead to
slow-down in CI jobs. See, also, angular/angular-cli#17533 for more
details of the impact of a growing CircleCI cache.

Unfortunately, using something like the lockfile checksum in the
fallback cache key would cause too many cache misses (esp. with
automatic updates via Renovate), again slowing CI down.

(The problem was originally discussed [here][2].)

This commit uses the technique described in [this blogpost][1] to
invalidate the cache monthly. This keeps the extra cache misses low
(essentially once per month per fork), while also preventing the cache
from growing indefinitely.

[1]: https://support.circleci.com/hc/en-us/articles/360012618473-Creating-a-daily-cache
[2]: https://github.com/angular/angular/pull/41467#discussion_r607818494

PR Close #41814

PR Close #41855
2021-04-28 09:15:46 -07:00
George Kalpakas 61ad68a586 fix(docs-infra): do not redirect disambiguated URLs (#41842) (#41854)
In #41788, logic was added to disambiguate case-insensitively equal docs
paths/URLs. This process includes appending a `-\d+` suffix to some
paths/URLs (for example, `/.../inject-1`). Unfortunately, some of the
Firebase redirects configured in `firebase.json` would match these URLs
and redirect them to non-existing paths.
Example failures: [stable][1], [next][2]

NOTE:
This was not picked up in the regular CI tests run for PRs, because the
local devserver and the preview server used to test PRs do not support
Firebase-like redirects.

This commit fixes this by ensuring these disambiguated paths/URLs are
not matched by the redirect rules by checking whether the part of the
suffix after the `-` contains any numeric digits. While this check is
not ideal, it should be good enough for our purpose, since the legacy
URLs that we do want to redirect contain suffixes such as `-class`,
`-function` and thus no numeric digits.

[1]: https://circleci.com/gh/angular/angular/974345
[2]: https://circleci.com/gh/angular/angular/974346

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas 96f5c86fbe build(docs-infra): take disambiguated doc paths into account when generating the sitemap (#41842) (#41854)
In ##41788, the `disambiguateDocsPathsProcessor` was introduced to fix
an issue with case-insensitively equal paths. This processor may alter
the paths of some docs and thus their final URL in the app.

Previously, both the `disambiguateDocPathsProcessor` and the
`createSitemap` processor (which relies on the docs' computed paths to
generate the sitemap file) were configured to run before the
"rendering-docs" phase. However, this resulted in the
`disambiguateDocPathsProcessor`'s running after `createSitemap`, which
meant that the sitemap did not include the updated doc paths.

This commit fixes it by ensuring that the
`disambiguateDocPathsProcessor` is explicitly run before the
`createSitemap` processor, so that the latter will be able to take into
account any changes made by the former.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas 84e1b10485 test(docs-infra): make it easier to identify the failing URL in testFirebaseRedirection.spec.ts (#41842) (#41854)
This commit includes the URL under test in the test description in
`testFirebaseRedirection.spec.ts` to make it easier to identify the
affected URL when a test fails.

It also avoids unnecessarily creating multiple `FirebaseRedirector`
instances by sharing instances between tests.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas 2b235b59a0 test(docs-infra): update firebase-test-utils to support regex-based redirects (#41842) (#41854)
This commit updates the utilities in `firebase-test-utils/` to also
support testing Firebase redirects that are configured using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas 6f4212f96f refactor(docs-infra): prepare firebase-test-utils for accepting regex-based redirects (#41842) (#41854)
Currently, the utilities for testing Firebase redirects assume that the
redirects are configured using the glob-based `source` property.
However, Firebase also supports configuring redirects using regular
expressions (via the `regex` property).
See the [Firebase docs][1] for more details.

This commit refactors the utilities in `firebase-test-utils/` to make it
easy to add support for such regex-based redirect configurations.

[1]: https://firebase.google.com/docs/hosting/full-config#redirects

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas ccb0ac3a74 test(docs-infra): fix create-example tests on Windows (#41842) (#41854)
Previously, the tests in `create-example.spec.ts` made assertions using
some hard-coded absolute paths (something like `/foo/bar`). This caused
the tests to fail on Windows, where the absolute paths are prefixed with
the drive letter (something like `C:/foo/bar`).

This commit uses `path.resolve()` to ensure paths are converted to the
format used on the current OS.

PR Close #41842

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas a26bbf78bc fix(docs-infra): apply custom autoLinkCode filters to single-word <code> elements (#41709) (#41854)
Previously, the `autoLinkCode` Dgeni post-processor would not apply the
custom filters when matching the whole contents of a `<code>` element.
This meant that custom filters would not be applied to single-word
`<code>` elements.

You can see occurrences of this issue in the following sections of the
"Reactive forms" guide:
- [Creating nested form groups][1]
  (look for `street, city, state, and zip controls`)
- [Using the FormBuilder service to generate controls][2]
  (look for `group method`)

This commit fixes this by also applying the custom filters when
processing the whole contents of a `<code>` element.

This commit also updates the `filterPipes` custom filter to allow
matching a pipe's name in a single-word `<code>` element (where there is
no preceeding `|` character).

[1]: https://v10.angular.io/guide/reactive-forms#creating-nested-form-groups
[2]: https://v10.angular.io/guide/reactive-forms#using-the-formbuilder-service-to-generate-controls

PR Close #41709

PR Close #41854
2021-04-28 09:13:42 -07:00
George Kalpakas 3d1f6938c2 fix(docs-infra): do not process generated nodes for auto-linking (#41709) (#41854)
While generating the docs, when a `<code>` element is inspected for
auto-linking, the `autoLinkCode` Dgeni post-processor will break its
contents up into words and generate text nodes for those words that
should not be auto-linked.

Previously, our text node visitor would visit these generated text nodes
and try to auto-link them too. As a result, it would unnecessarily
process nodes that had already been checked (and could potentially
generate links that would otherwise be ignored).

You can see an occurrence of this issue in the
[Create the product list][1] section of the
"Getting started with Angular" tutorial (look for `<a>`).

This commit fixes this by ensuring the visitor will skip the current
node and any nodes generated by `autoLinkCode`.

[1]: https://v11.angular.io/start#create-the-product-list

PR Close #41709

PR Close #41854
2021-04-28 09:13:42 -07:00
Jessica Janiuk 4aafcc06ed Revert "feat(dev-infra): create the prettier formatter for ng-dev format tooling (#41824)" (#41844)
This reverts commit 4d760ba8f0.

PR Close #41844
2021-04-27 13:24:29 -07:00
Joey Perrott 4d760ba8f0 feat(dev-infra): create the prettier formatter for ng-dev format tooling (#41824)
Add support to use prettier for formatting using `ng-dev format`.

PR Close #41824
2021-04-27 12:23:06 -07:00
Pete Bacon Darwin eedbb758d2 build(docs-infra): update dgeni-packages to fix version list (#41841)
The current version was not being computed correctly for
next and rc deployments of the angular.io website.

Fixes #41829

PR Close #41841
2021-04-27 12:22:02 -07:00
Zach Arend e7586581af ci: add Zach Arend to pullapprove groups (#41839)
Add Zach Arend to the pullapprove groups for public api, size tracking,
and circular deps.

PR Close #41839
2021-04-27 11:35:04 -07:00
Joey Perrott 84a44a9b0f fix(dev-infra): add github token requirement for discover-new-conflicts (#41825)
Add the github token option/requirement for the pr discover-new-conflicts
command.

PR Close #41825
2021-04-27 10:23:18 -07:00
Amadou Sall c78baccf8d docs: remove the section "Using components vs services from other modules" (#41835)
This section states that "Importing a module with services means that you will have a new instance of that service". This is only true for lazy-loaded `NgModules`. For non-lazy-loaded modules, my understanding is that the providers arrays are flattened into the root injector meaning that importing a module with a service doesn't create a new instance of that service.

PR Close #41835
2021-04-27 10:16:51 -07:00
Pete Bacon Darwin de39b49c6d fix(compiler): strip scoped selectors from @font-face rules (#41815)
`@font-face` rules cannot contain nested selectors. Nor can they be
nested under a selector. Normally this would be a syntax error by the
author of the styles. But in some rare cases, such as importing styles
from a library, and applying `:host ::ng-deep` to the imported styles,
we can end up with broken css if the imported styles happen to contain
`@font-face` rules.

This commit works around this problem by sanitizing such cases (erasing
any scoping selectors) during emulated ShadowDOM encapsulation style
processing.

Fixes #41751

PR Close #41815
2021-04-27 09:12:29 -07:00
Kapunahele Wong 7756ead0bf docs: add metadata documentation to httpClient (#41706)
PR Close #41706
2021-04-26 15:17:52 -07:00
Chau Tran 072a0bf30a docs: add chau tran to GDE resources (#41817)
PR Close #41817
2021-04-26 15:16:41 -07:00
Pete Bacon Darwin aa578f56bf docs: fix links to docs with ambiguous paths (#41788)
These docs were linking directly to docs that have ambiguous paths.
These changes ensure that these links are not affected by the
disambiguation processing of those docs.

PR Close #41788
2021-04-26 12:12:01 -07:00
Pete Bacon Darwin 9f958077d2 build(docs-infra): add path disambiguation (#41788)
When two documents have the same `outputPath`, only differing by
letter casing, there can be problems on case-insensitive file-systems:
Only one of each of the docs would end up being written.

Moreover, the Webpack 5 bundler will error if it comes across files
that have this kind of ambiguous paths.

This commit adds a new docType: `disambiguator`, which will display
a list of the docs that match an ambiguous path. Each of the ambiguous
docs is then given a unique path and outputPath to ensure there are no
collisions.

PR Close #41788
2021-04-26 12:12:01 -07:00
Pete Bacon Darwin 09f3531c44 build(docs-infra): no duplicate docTypes in postProcessHtml processor (#41788)
This processor was being initialized with the same docTypes twice.

PR Close #41788
2021-04-26 12:12:01 -07:00
George Kalpakas 21f1466d84 build(docs-infra): fix e2e testing SystemJS-based docs examples (#41796)
This commits makes the SystemJS-based docs examples more self-contained
by ensuring the necessary WebDrivers are fetched before running the e2e
tests.
This is a follow-up to #41689. (See there for more discussion.)

PR Close #41796
2021-04-26 09:25:13 -07:00
George Kalpakas 6fb18b8fd5 fix(docs-infra): fix external link icons positioning (#41794)
While trying to fix the appearance of `<code>` elements inside of
anchors with external URLs in #41694, the positioning of external link
icons was broken for anchors that would span multiple lines (see #41774
for details).

This commit fixes the positioning of external link icons, while still
preserving the correct appearance of `<code>` elements inside anchors
with external URLs.

NOTE:
Different types of links with external URLs can be seen in the following
docs sections:
- http://localhost:4200/docs#assumptions
- http://localhost:4200/guide/http#security-xsrf-protection
- http://localhost:4200/guide/workspace-config#generation-schematics

Fixes #41774

PR Close #41794
2021-04-26 09:24:05 -07:00
Kapunahele Wong 8ea1927910 docs: improve accessibility of architecture example (#41314)
PR Close #41314
2021-04-26 09:13:51 -07:00
Kapunahele Wong 619f774dbd docs: make inputs-outputs example more accessible (#41288)
PR Close #41288
2021-04-26 09:12:19 -07:00
Kapunahele Wong f31277879a docs: improve accessibility of http example (#41057)
PR Close #41057
2021-04-26 09:11:08 -07:00
Sam Severance 163c076f97 docs: Indicate HttpClientModule being imported (#41749)
PR Close #41749
2021-04-23 11:38:35 -07:00
Emily Wenberg dd46b87bc7 fix(upgrade): preserve $interval.flush when ngMocks is being used (#30229)
Also preserve any other properties that the user may have decorated
$interval with.

PR Close #30229
2021-04-23 09:44:52 -07:00
Jessica Janiuk 42c64aa376 Revert "build(docs-infra): fix StackblitzBuilder after jsdom update (#41725)" (#41768)
This reverts commit 2a2c239a0a.

PR Close #41768
2021-04-22 10:14:48 -07:00
Aristeidis Bampakos ad2d239b13 docs: ident the library shematics guide properly (#41755)
PR Close #41755
2021-04-22 08:41:03 -07:00
George Kalpakas 2a2c239a0a build(docs-infra): fix StackblitzBuilder after jsdom update (#41725)
In commit c617f1f768, `jsdom` was updated
from v9 to v16. This includes a breaking change that caused
`StackblitzBuilder` to fail to generate the StackBlitz examples.
However, this failure went unnoticed, because `StackblitzBuilder` still
completed successfully after failing to generate the examples. (This has
been fixed in the previous commit.)

This commit updates `StackblitzBuilder` to use the new `jsdom` API.

PR Close #41725
2021-04-22 08:38:22 -07:00
George Kalpakas 0ae0ac68f3 build(docs-infra): exit with an error code if generating StackBlitz examples fails (#41725)
Previously, failing to generate one or more StackBlitz examples would
log the errors but exit the command successfully. This made it easy to
miss such failures.

This commit fixes this by exiting the process with an error code if
generating one or more StackBlitz examples fails.
(In order to be able to see all potential errors, all examples are
attempted to be generated before exiting the process.)

PR Close #41725
2021-04-22 08:38:21 -07:00