Compare commits

...

126 Commits

Author SHA1 Message Date
Dylan Hunn 7a47add255 release: cut the v13.2.2 release (#45018)
PR Close #45018
2022-02-08 09:39:47 -08:00
Alan Cohen 7bc4dbd7ff docs: fix command to clear cache on Windows (#44988)
PR Close #44988
2022-02-07 21:18:03 -08:00
Andrew Kushnir d40ac2056e refactor(core): drop all .ngfactory and .ngsummary imports (#44957)
This commit updates various places in the repo (mostly tests/examples) to drop all `.ngfactory` and `.ngsummary` imports as they are no longer needed in Ivy.

PR Close #44957
2022-02-07 15:31:49 -08:00
Shai Reznik 1368f58b49 docs: add Cost-Effective Angular Testing (#44969)
to resources
PR Close #44969
2022-02-07 13:17:35 -08:00
Kristiyan Kostadinov b75e90f809 fix(forms): incorrectly keeping track of ngModel with ngFor inside a form (#40459)
When an `NgModel` is created within a `form`, it receives an `NgControl` based on its `name`, but
the control doesn't get swapped out if the name changes. This can lead to problems if the `NgModel`
is part of an `ngFor`, because the name can change based on its position in the list and a new
control can be defined with the same name, leading us to having multiple directives pointing to
the same control. For example, if we start off with a list like :

```
[0, 1, 2]; -> [NgModel(0), NgModel(1), NgModel(2)]
```

Then we remove the second item:

```
[0, 2]; -> [NgModel(0), NgModel(2)]
```

And finally, if we decide to add an item to the end of the list, we'll already have a control for
index 2, causing the list to look like:

```
[0, 2, 3]; -> [NgModel(0), NgModel(2), NgModel(2)]
```

These changes fix the issue by removing the old control when the `name` of the directive changes.

Fixes #38465.
Fixes #37920.

PR Close #40459
2022-02-07 13:16:10 -08:00
iRealNirmal 3919ee37cf refactor(forms): update PatternValidator to inherit AbstractValidatorDirective (#44887)
This commit updates the `PatternValidator` class to inherit `AbstractValidatorDirective` to make it conistent with other validators.

Closes angular#42267

PR Close #44887
2022-02-07 12:07:35 -08:00
JoostK 37af6abb49 fix(compiler): allow banana-in-a-box bindings to end with non-null assertion (#37809)
For two-way-bindings that use the banana-in-a-box syntax, the compiler
synthesizes an event assignment expression from the primary expression.
It is valid for the primary expression to be terminated by the non-null
operator, however naive string substitution is used for the synthesized
expression, such that the `!` would immediately precede the `=` token,
resulting in the valid `!=` operator token. The expression would still
parse correctly but it doesn't implement the proper semantics, resulting
in incorrect runtime behavior.

Changing the expression substitution to force a space between the
primary expression and the assignment avoids this mistake, but it
uncovers a new issue. The grammar does not allow for the LHS of an
assignment to be the non-null operator, so the synthesized expression
would fail to parse. To alleviate this, the synthesized expression is
parsed with a special parser flag to allow for this syntax.

Fixes #36551

PR Close #37809
2022-02-07 10:46:53 -08:00
Alan Agius 604a67f0a1 ci: group all scorecard action dependencies (#44998)
With this change we group all the scorecard action dependencies so that Renovate opens a single PR.

PR Close #44998
2022-02-07 09:46:29 -08:00
dario-piotrowicz baf0c7a11a docs(docs-infra): fix cosidered typo (#44987)
fix the "cosidered" typo (which should be "considered")

PR Close #44987
2022-02-07 09:45:22 -08:00
Renovate Bot cd97d8793f build: update all non-major dependencies (#44974)
Patch port of #44963

PR Close #44974
2022-02-04 11:55:23 -08:00
Ramzan 3fae6637e7 perf(http): remove IE special status handling (#44354)
revert the condition as dev only

PR Close #44354
2022-02-04 11:45:16 -08:00
Andrew Kushnir 30d1c34384 refactor(core): cleanup DebugNode and DebugElement implementations (#44270)
This commit updates `DebugNode` and `DebugElement` implementaitons to cleanup ViewEngine removal artifacts. There is no need for a separate interface and implementation class, so we can combine them now. This comment also gets rid of `R3` suffixes (denoting Ivy) in helper methods.

PR Close #44270
2022-02-04 10:43:43 -08:00
Jayson Acosta 1384013a00 docs: correct typo (#44793)
Service worker card contains typo 'us' when it should be 'use.'
PR Close #44793
2022-02-04 10:42:26 -08:00
zuckjet 9327e97500 refactor(dev-infra): convert nullish coalescing operator to plain javascript (#44968)
low version nodejs doesn't support nullish coalescing operator very well

PR Close #44968
2022-02-04 10:40:44 -08:00
Joey Perrott 59a6ec4396 build: exclude devtools scope from generated changelogs (#44964)
The devtools scoped commits are not included in the repository's CHANGELOG.md
file as these commits are not references areas which are included in the
primary released artifacts.

PR Close #44964
2022-02-03 15:19:26 -08:00
Olivier Capuozzo 1b216297f4 docs: update input-output-diagram.svg (#39900)
"deleteRequest" is the *event* (not target) and "crossOffItem" is the *handler* of the event (not "source").

PR Close #39900
2022-02-03 14:51:00 -08:00
Joey Perrott a89805c3ae build: setup OpenSSF Scorecard (#44960)
Set up OpenSSF Scorecard to begin tracking security metrics within the repo.

PR Close #44960
2022-02-03 14:50:23 -08:00
jhonyeduardo f092badb9c docs: add po-ui to UI Components resources (#43689)
PR Close #43689
2022-02-03 12:45:40 -08:00
dario-piotrowicz d27015a43c refactor(docs-infra): add types to all the aio examples buttons (#44557)
add types to all the buttons in the angular.io examples to encourage
the best practice of always including a type per button (regardless
to whether it is in a form or now)

PR Close #44557
2022-02-03 12:44:48 -08:00
dario-piotrowicz b9aee9070c refactor(docs-infra): remove outdated comments regarding CustomEvent (#44557)
remove the comments present in aio examples saying that for older
browsers such as IE CustomEvent could be necessary (as the the Event
constructor could be not available)

such comments are no longer necessary/relevant since the Event constructor
is available for all the supported browsers

PR Close #44557
2022-02-03 12:44:48 -08:00
Dario Piotrowicz 5fdd8ae3ba refactor(docs-infra): fix template eslint issues in aio examples (#44557)
the aio examples have various eslint issues regarding template rules, those
are currently turned off and TODO comments have been added to them in the
examples eslintrc, fix such issues and remove the respective TODO comments

this also includes examples refactoring to use buttons for better accessibility,
this change tries to make the smallest amound of changes to the examples' behaviors
and designs/UI

PR Close #44557
2022-02-03 12:44:48 -08:00
TANMAY SRIVASTAVA b2f474c4c9 docs: describe your change... (#42899)
in the last Lines ViewEncapsulationComponent should be EmulatedEncapsulationComponent as there is no such  ViewEncapsulationComponent  exists in this example where as 
ShadowDomEncapsulationComponent  contains NoEncapsulationComponent and EmulatedEncapsulationComponent
PR Close #42899
2022-02-03 12:41:36 -08:00
dario-piotrowicz 38b042b6d0 docs: improve punctuation in animation sequence summary (#44567)
slightly improve the punctuation in the animation sequence summary present
in the complex animation sequences guide

PR Close #44567
2022-02-03 12:40:53 -08:00
Dario Piotrowicz 48262bcb70 docs(animations): add section about animating reordering list items (#44567)
add a section regarding reordering list items in the complex animation
sequences guide to help developers rememeber to use a `TrackByFunction`
whenever they are animating `*ngFor` list items which change their
ordering

as suggested here: https://github.com/angular/angular/issues/42750#issuecomment-979127165

relates to issue #28040 and #42750

PR Close #44567
2022-02-03 12:40:53 -08:00
Andrew Scott fb3c0b2605 docs: remove item from changelog that does not work (#44961)
After trying this feature, it turns out the approach does not work and we
will be reverting the commits. Note that the feature _never_ worked so it's
not a breaking change.

PR Close #44961
2022-02-03 12:40:01 -08:00
Daniel Díaz fecd4f8eab docs: remove duplicate closing tags in View Encapsulation file (#44958)
PR Close #44958
2022-02-03 08:54:00 -08:00
Doug Parker 9cce12cbf5 refactor(compiler): add @suppress {msgDescriptions} if no description is present on an i18n message (#44787)
Refs http://b/214103351.

This happens if a user writes `<span i18n>Message</span>`. This is accepted as an internationalized message, but without a description. JSCompiler will throw an error in this situation because descriptions are generally required. Now, the Angular compiler will generate a suppression annotation so JSCompiler allows the syntax. This will ease an internal migration to JSCompiler-based i18n.

PR Close #44787
2022-02-02 15:33:45 -08:00
Andrew Scott b9aab0c87b fix(upgrade): Do not trigger duplicate navigation events from Angular Router (#43441)
This code mimics behavior that Google Analytics has been using to
prevent duplicate navigations. They set up their own `HybridRoutingService`
location sync to avoid duplicate navigations that came from the Angular
router. This would happen because the Angular router would trigger a
navigation, which would then get picked up by the `$locationShim`, which
would trigger a `$locationChangeStart`, which would then be picked up by
the `setUpLocationSync` watcher here, which would again trigger a
navigation in the Angular Router.

All of this can be prevented by checking if the `navigationId` exists on
the history state object. This property is added by the Angular router
during navigations.

fixes #21610

PR Close #43441
2022-02-02 19:51:20 +00:00
Andrew Scott 123f42c744 test(upgrade): update router upgrade tests to use fewer mocks (#43441)
This updates the router upgrade tests to use less mocked behavior. The
test upgrade location module is copied from the one that's used in the
common package. This update to the tests verifies more real behavior of
the upgrade module.

PR Close #43441
2022-02-02 19:51:20 +00:00
mgechev 64adfc9150 docs: remove banner after survey expiration (#44949)
The survey is now over. We can remove the banner.

PR Close #44949
2022-02-02 19:50:20 +00:00
Jessica Janiuk 7924a2e497 release: cut the v13.2.1 release (#44948) 2022-02-02 10:42:38 -08:00
George Kalpakas 98a1da9382 build(docs-infra): upgrade cli command docs sources to 0f51d5c70 (#44943)
Updating [angular#13.2.x](https://github.com/angular/angular/tree/13.2.x) from
[cli-builds#13.2.x](https://github.com/angular/cli-builds/tree/13.2.x).

##
Relevant changes in
[commit range](https://github.com/angular/cli-builds/compare/9ac3df5d1...0f51d5c70):

**Modified**
- help/test.json

PR Close #44943
2022-02-02 17:07:59 +00:00
mgechev 165aa4f164 docs: update the survey expiration date (#44938)
Extend with a few more days since the survey is still open.

PR Close #44938
2022-02-02 01:56:40 +00:00
JoostK 4a5ad1793f fix(compiler-cli): ensure casing of logical paths is preserved (#44798)
The logical filesystem would store a cached result based on the canonical path,
where the cached value contains the physical path that was originally provided.
This meant that other physical paths with an identical canonical path would use
a cached result derived from another physical path.

This inconsistency is not known to result in actual issues but is primarily
being made as a performance improvement, as using the provided physical paths
as cache key avoids the need to canonicalize the path if its result is already
cached.

PR Close #44798
2022-02-02 00:04:38 +00:00
JoostK d65a42b183 refactor(compiler-cli): use relative imports into dts files as fallback in type-check files (#44798)
The generated imports should normally use module specifiers that are valid for
use in production code, where arbitrary relative imports into e.g. node_modules
are not allowed. For template type-checking code it is however acceptable to
use relative imports, as such files are never emitted to JS code. It is
desirable to allow a filesystem relative import as fallback if an import would
otherwise fail to be generated, as doing so allows fewer situations from
needing an inline type constructor.

PR Close #44798
2022-02-02 00:04:37 +00:00
JoostK dee108b67c refactor(compiler): remove ViewEngine identifiers (#44676)
This commit removes the leftover `Identifiers` class that was used in the
ViewEngine compiler. The remaining usages of the `inlineInterpolate` and
`interpolate` instructions were refactored to make use of an
`InterpolationExpression` output expression to capture the argument list of an
interpolation expression. An attempt was made to refactor this further by
converting to the desired interpolation instruction immediately, but some
downstream consumers are designed in a way where the argument list itself is
needed, e.g. as other arguments need to be prepended/appended.

PR Close #44676
2022-02-02 00:04:14 +00:00
Andrew Scott 5a75721835 build: fix test for useUnknownInCatch (#44935)
CI ran before the change to the tsconfig file

PR Close #44935
2022-02-01 23:40:17 +00:00
markostanimirovic ec49796807 docs(router): provide better typing for resolver example (#44932)
PR Close #44932
2022-02-01 22:06:29 +00:00
JoostK b4e4617807 fix(common): include query parameters for open HTTP requests in verify (#44917)
When `HttpTestingController.verify` is used to verify that there are not open,
unexpected requests it would throw an error with the method and URL of all pending
requests, excluding the query parameters. This is confusing, as e.g. `expectOne`
matches a URL including its query parameters and `expectOne` does include the
query parameters when it reports when no request could be matched.

This commit changes the error that is reported by `verify` to include the query
parameters.

Closes #19974

PR Close #44917
2022-02-01 21:41:43 +00:00
Renovate Bot 812c1ba971 build: update all non-major dependencies (#44930)
PR Close #44930
2022-02-01 21:30:10 +00:00
David Shevitz 1cc1588c29 docs: fix incorrect title and tooltip in navigation (#44710)
Fixes #44589

In the navigation pane, the title and tooltip for the page,
Preparing component for translation, are incorrect. This PR
fixes this issue.

PR Close #44710
2022-02-01 19:17:40 +00:00
Alan b6d2212ce5 docs: correct the demo code of NgZone.run (#44733)
`NgZone.run` needs to be within the async closure, not around its registration, refer to: https://github.com/angular/angular/issues/44714
PR Close #44733
2022-02-01 19:16:16 +00:00
Andrew Scott a432ad65c7 build: Update 13.2.x for useUnknownInCatch (#44929)
36b16e667a enabled `useUnknownInCatchVariables`
but broke the build becaue the migration does not exist on the main
branch.

PR Close #44929
2022-02-01 19:15:06 +00:00
Arjen 96b3b774c3 docs: explain how ngsw.json is generated (#44823)
Update aio/content/guide/service-worker-devops.md

ngsw.json is the manifest file which is generated at build time ( based on ngsw-config.json ). This explains this a bit clearer.
At first, I thought that it was a wrongly named filename. Not is it explicitly described.

Co-Authored-By: George Kalpakas <kalpakas.g@gmail.com>

PR Close #44823
2022-02-01 18:26:42 +00:00
Doug Parker 365962948a refactor(compiler-cli): remove leftover _extendedTemplateDiagnostics flag (#44920)
This flag is currently a no-op because extended diagnostics are enabled in production.

PR Close #44920
2022-02-01 18:24:10 +00:00
Daniel Díaz 577d97f757 docs: add colon before introducing the list of items (#44751)
PR Close #44751
2022-02-01 18:20:47 +00:00
Andrew Scott 36b16e667a build: enable useUnknownInCatchVariables (#44679)
This unblocks the internal migration to turn the option on in g3.

PR Close #44679
2022-02-01 18:17:29 +00:00
Andrew Kushnir 2916ac9e1a refactor(core): the RuntimeError class should support more compact syntax (#44783)
This commit refactors the `RuntimeError` class to support a short version of providing error messages:
```
throw new RuntimeError(
  RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
  ngDevMode && 'Injector has already been destroyed.');
```
In prod mode, the second argument becomes `false` andn this commit extends the typings to support that.

This commit also contains a couple places were the `RuntimeError` class is used to demostrate the compact form.

PR Close #44783
2022-02-01 00:15:56 +00:00
Andrew Kushnir 4644886aaf perf(animations): remove no longer needed CssKeyframes classes (#44903) (#44919)
This commit removes CSS keyframes-based code that was used to support animations in old browsers. With IE11 deprecation, all supported browsers have native WebAnimations support, so the old code can be removed. This results in ~7KB decrease of the animations package bundle size, since most of the code was non-tree-shakable.

Closes #44520.

PR Close #44919
2022-01-31 22:46:00 +00:00
JoostK f5ce6cfa1e refactor(compiler-cli): remove unused canonical-path dependency (#44918)
This package is no longer used within `compiler-cli` so is being removed as a dependency.

PR Close #44918
2022-01-31 21:39:54 +00:00
Andrew Scott 7ec482d9c2 fix(core): Add back support for namespace URIs in createElement of dom renderer (#44914)
Support for namespace URIs rather than short namespace names was added in
https://github.com/angular/angular/commit/2b9cc8503d48173492c29f5a271b61126104fbdb to
support how Ivy passed around the namespace URI rather than short name at the time.
As a side-effect, this meant that namespace URIs were supported by the
default dom renderer as part of the public API (likely unintentionally).

It did not, however extend the support to other parts of the system (setAttribute, setAttribute,
and the ServerRenderer). In the future we should decide what exactly the
semantics for dealing with namespaces should be and make it consistent.

fixes #44028

PR Close #44914
2022-01-31 21:39:29 +00:00
Andrew Kushnir 98ba48eedf refactor(core): strict templates type-checking compatibility for perf tests (#44905)
This commit updates a type used in the transplanted views perf tests, to make the test compatible with strict template type-checking.

Currently, compiling the perf test results in the following TS error:
```
error TS2322: Type 'TemplateRef<{}>' is not assignable to type 'TemplateRef<NgForOfContext<any, any[]>>'.

17     <ng-container *ngFor="let n of views; template: template; trackBy: trackByIndex"></ng-container>
                                             ~~~~~~~~
```

PR Close #44905
2022-01-31 21:39:04 +00:00
arturovt 1aebbf8714 fix(forms): ensure OnPush ancestors are marked dirty when the promise resolves (#44886)
Currently, `ngModel` calls` setValue` after the `resolvedPromise` is resolved.
The promise is resolved _after_ the child template executes. The change detection
is run but `OnPush` views are not updated because they are not marked as dirty.

PR Close #44886
2022-01-31 21:38:39 +00:00
Andrew Kushnir 250dc40a46 fix(core): flush delayed scoping queue while setting up TestBed (#44814)
Previously, some NgModules that were added to the delayed scoping queue, never got removed from the queue before unit test execution. That resulted in some components (declared in those NgModules) missing their scope (which components/directives/pipes were matched).

This commit adds the logic to invoke delayed scoping queue flushing before starting a test to avoid missing/incomplete scopes for Components used in a test.

PR Close #44814
2022-01-31 21:37:53 +00:00
Lee Robinson 8fb2e3b71f docs: Update deployment docs for Vercel (#44904)
PR Close #44904
2022-01-31 21:32:42 +00:00
Doug Parker 626980f3eb build: fix update_all_goldens.js to use ESM. (#44916)
Attempting to run as is fails because we have `"type": "module"`. `shelljs` is a CommonJS module however, so we need to do a default import and destructure.

```
$ node packages/compiler-cli/test/compliance/update_all_goldens.js
const {exec} = require('shelljs');
               ^

ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/home/douglasparker/Source/ng/packages/compiler-cli/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///home/douglasparker/Source/ng/packages/compiler-cli/test/compliance/update_all_goldens.js:11:16
    at ModuleJob.run (node:internal/modules/esm/module_job:183:25)
    at async Loader.import (node:internal/modules/esm/loader:178:24)
    at async Object.loadESM (node:internal/process/esm_loader:68:5)
    at async handleMainPromise (node:internal/modules/run_main:63:12)
```

PR Close #44916
2022-01-31 21:31:11 +00:00
Paul Gschwendtner 5400a3d88a build: fix formatting in zone.js BUILD file (#44911)
Fixes formatting in one of the Zone BUILD files.
The lint check on the renovate branch did not check
formatting as it seems. Needs more investigation as
the PR was green.

PR Close #44911
2022-01-31 21:28:25 +00:00
Paul Gschwendtner e07014f3d9 build: update legacy saucelabs bundle generation to account for esbuild update (#44911)
Previously with ESBuild 0.14.11, when a file had dynamic requires to
builtin NodeJS modules like `url`, the resolution completed successfully
regardless of `--platform browser`. This seems to be fixed in ESBuild now.

This unveiled some resolution errors with our Saucelabs bundle generation
because the framework code sometimes switches dynamically to `require('url')`
if `window.URL` is not defined. Previously this just didn't matter, but now
the `require('url')` is checked and a module resolution error is reported given
`url` not being available in the browser as a builtin module.

We fix this by marking the module as external. We will not hit this code path
anyway in the browser saucelabs code. Similarly we exclude all platform-server
files from the bundle. This is not strictly needed after the `url` module being
marked as external, but the issue showed that lots of unnecessary code for the
server platform is included. This can be omitted (unfortunately not from the TS
compilation without over-complicating things significantly more; experimented with
that).

PR Close #44911
2022-01-31 21:28:25 +00:00
Paul Gschwendtner 85b889e6fb build: update postinstall patch to account for benchmark macro changes (#44911)
Updates the postinstall patch for the benchmark macro rule from dev-infra.
We moved the ZoneJS setup to the bundler. This was necessary in order to
switch away from the Go-based (windows-incompatible, m1-incompatible)
concatjs devserver to a rather basic HTTP server (also provided by dev-infra now).

PR Close #44911
2022-01-31 21:28:25 +00:00
Renovate Bot 881d4696a2 build: update angular (#44911)
Updates to the latest version of Angular.

PR Close #44911
2022-01-31 21:28:25 +00:00
JoostK 07185f4ed1 fix(compiler-cli): enable nullish coalescing check only with strictNullChecks (#44862)
TypeScript configures `strictNullChecks` to be disabled by default, so the nullish
coalescing check should follow the same default. The rule actively depends on
`strictNullChecks`, as TypeScript doesn't include `null`/`undefined` in its types
otherwise so the check wouldn't have a way to differentiate between them.

This commit also takes the `strict` flag into account when `strictNullChecks` itself
is not configured.

PR Close #44862
2022-01-31 20:31:58 +00:00
JoostK 0778e6f7d7 fix(compiler-cli): accept nullish coalescing operator for any and unknown types (#44862)
We should not make assumptions about the any and unknown types; using a nullish
coalescing operator is acceptable for those.

PR Close #44862
2022-01-31 20:31:58 +00:00
Esteban Gehring 25f8305195 docs(core): showcase host listener support for specific keys in events (#44833)
PR Close #44833
2022-01-31 20:30:45 +00:00
Juri Strumpflohner b51d111d72 docs: update Nx headline (#44910)
PR Close #44910
2022-01-31 19:46:36 +00:00
Aristeidis Bampakos 72cdd1403b docs: add code format in content projection guide (#44907)
PR Close #44907
2022-01-31 19:45:47 +00:00
George Kalpakas c1fc425cd1 fix(docs-infra): make it possible to see whole notification text on smaller screens (#44900)
Previously, when the notification text did not fit on the viewport
width, it got truncated and it was not possible to see the whole text.

This commit fixes this by making the notification scrollable when the
text overflows.

PR Close #44900
2022-01-31 19:44:52 +00:00
George Kalpakas e62c98f2aa fix(docs-infra): make it easier to interact with notification on smaller screens (#44900)
On smaller screens, the action button in `NotificationComponent` is
hidden (due to limited horizontal screen "real estate"). Thus, the only
way to perform the action is to click on the notification message, which
is typically a link.

Previously, the link inside the notification did not take up the whole
height of the notification bar. As a result, clicking outside the link
would dismiss the notification without following the link.

This commit makes it easier to interact with the notification (esp. on
smaller screens) by ensuring the link covers the whole notification bar
(width and height).

PR Close #44900
2022-01-31 19:44:52 +00:00
Andrew Scott 47c02caa29 refactor(compiler-cli): Update where and how the indexed errors are exposed (#44884)
The initial commit e9124b42d5 stored the errors rather than
throwing but did not store them in a place that was accessible to consumers. Instead,
the errors should be added to the IndexedComponent so they can be surfaced where the
index results are consumed

PR Close #44884
2022-01-31 18:36:55 +00:00
George Kalpakas 94c9e47dbe Revert "fix(docs-infra): content overflow in mobile (#44851)" (#44899)
This reverts commit c2e09e0911, because it
messes up the table layouts on some resolutions/pages. See #44891 for
details.

Fixes #44891

PR Close #44899
2022-01-31 17:10:50 +00:00
Dylan Hunn 6b7fffcbeb fix(forms): Update the typed forms migration schematic to find all files. (#44881)
We were breaking out of the loop that walks the source tree due to an incorrect return.

PR Close #44881
2022-01-28 21:59:35 +00:00
fru2 641f27a9c9 fix(docs-infra): content overflow in mobile (#44851)
When reading the docs page on mobile, some page tend to scroll in horizontal direction quite a lot which is unpleasant

Fixes #44850

PR Close #44851
2022-01-28 18:01:47 +00:00
Paul Gschwendtner ab63ed3448 test(docs-infra): fix type checking errors with new jasmine types (#44876)
The jasmine types for `spyObj.calls().all()` seem to be more specific,
relying on `ThisType<Fn>` to determine the context/receiver for an invoked
spy. This type does not work as expected with class members as it seems.

This commit fixes three of these type checking failures by explicitly casting
the spy context to the actual class owning the method member.

PR Close #44876
2022-01-28 17:50:15 +00:00
Renovate Bot b89ee0819b build: update angular (#44876)
Updates to the latest versions of Angular organization NPM packages.

PR Close #44876
2022-01-28 17:50:15 +00:00
Renovate Bot 553c8d1366 build: lock file maintenance (#44876)
Cleans up the lock file by maximizing the versions as allowed per our
version ranges.

PR Close #44876
2022-01-28 17:50:15 +00:00
Maarten Tibau f398717502 docs: fix typo in update guide (#44853)
PR Close #44853
2022-01-28 17:37:25 +00:00
Aristeidis Bampakos c9abf34d88 docs: fix GitHub broken link in update guide (#44875)
PR Close #44875
2022-01-28 16:08:28 +00:00
George Kalpakas 96d2c58647 fix(docs-infra): fix links to CLI commands source code (#44835)
Recently, the [CLI repository][1] switched to not prefixing tag names
with a `v`. Update the `versionInfo` generated for CLI commands docs, so
that the links to the source code (which include the tag name) are
correct.

Fixes #44822

[1]: https://github.com/angular/angular-cli

PR Close #44835
2022-01-28 16:07:47 +00:00
Theodore Brown 49ca5bb1d8 refactor(forms): remove dead code (#37614)
This functionally dead code was originally introduced via pull request
were added to verify the fix, and the many comments on that issue after
it was closed indicate that it wasn't actually resolved.

In fact, setting `selectedIndex` does absolutely nothing here, since
the selected index is immediately overridden by setting the `value`
property. A working fix (with tests) for the IE/Safari bug is in pull
request #23784. Originally this dead code was removed as part of that PR,
but @AndrewKushnir recommended creating a separate PR for the cleanup.

PR Close #37614
2022-01-28 16:07:11 +00:00
dario-piotrowicz f6c2934f5b docs(core): edit and add docs for ng-container (#44762)
PR Close #44762
2022-01-28 15:55:33 +00:00
Andrew Kushnir 1169fae366 docs: update survey id (#44865)
The survey id is used as a key in the local storage to keep the state (don't show the message again). Reusing this survey id will make the message invisible to some users who already have that key in local storage.

PR Close #44865
2022-01-27 21:52:35 +00:00
mgechev 522b845bec docs: enable the survey banner (#44861)
PR Close #44861
2022-01-27 11:43:54 -08:00
Paul Gschwendtner 2fa2f7d34a ci: only build test targets for components repo unit test job (#44832)
To speed up the components CI job (avoiding it being a bottleneck in FW),
we will stop building everything in `src/...`, but rather only build targets
which are needed to run all tests within `src/...`.

This notably should avoid unnecessary NPM package building. Arguably that
part would also be valuable to have, but we already test the `ng_package`
rule in FW itself, plus we run snapshot tests in the components repo as well.

PR Close #44832
2022-01-27 09:22:24 -08:00
Paul Gschwendtner af19c440e2 ci: re-enable components repo unit tests job (#44832)
Re-enables the components-repo unit tests job that we previously
disabled due to the devmode target change that caused conflicts
with `angular/components` patching `ng_module.bzl` of `@angular/bazel`.

PR Close #44832
2022-01-27 09:22:24 -08:00
Andrew Scott 9f7157e560 refactor(compiler-cli): Tolerate source span errors in indexer (#44825)
When the indexer encounters a location where the source span doesn't
match up with the expected identifier, the current visitor code throws
an error. Instead, this change creates an error and moves on to the next
template item. This allows the indexer to continue analysis even when
there are errors in the source mapping. In addition, it still allows callers
to surface those errors in their own way while still providing as much indexed
information as possible about a node.

PR Close #44825
2022-01-27 09:20:09 -08:00
Renovate Bot 30ddeabca6 build: update dependency globby to v13 (#44801)
PR Close #44801
2022-01-27 09:18:58 -08:00
Renovate Bot 4a91d9b0a0 build: update dependency rules_pkg to v0.6.0 (#44818)
PR Close #44818
2022-01-26 17:37:42 -08:00
Jessica Janiuk fcc6528159 test(animations): Add bundling size regression test for animations package (#44826)
This adds a size regression test for the animations package to the test suite.

PR Close #44826
2022-01-26 12:54:36 -08:00
Andrew Kushnir dc0cac235f docs: cleanup CHANGELOG.md file (#44842)
PR Close #44842
2022-01-26 12:37:05 -08:00
Andrew Kushnir de1e35b944 release: cut the v13.2.0 release (#44838) 2022-01-26 11:44:41 -08:00
Dylan Hunn a38ae0aefa refactor(forms): Temporarily disable the typed forms migration. (#44828)
It's best to disable this optional migration in the minor release, although it shouldn't run anyway -- we don't want people accidentally running it.

This PR will be rolled back after the minor is out.

PR Close #44828
2022-01-25 17:03:48 -08:00
Andrew Scott fe3e4d6865 fix(compiler-cli): Handle ng-template with structural directive in indexer (#44788)
An `ng-template` with an inline template (i.e. has a structural
directive) would previously not get an `undefined` `tagName` because the
logic assumed the element would be `t.Element` or `t.Content` and read
the tag name from the `name` property. For a `t.Template`, this exists
instead on the `t.tagName`. The final result would be an `tagName` of `undefined`
for the parent `t.Template`, causing failures in the indexer downstream.

This `undefined` value is actually expected in the renderer code, even
though the type does not specify this possibility. This change updates
the type of `tagName` to be `string|null` and explicitly handles the
case where there is a structural directive on an `ng-template`. You can
see how the two are differentiated in the compliance code that was
modified in this commit.

PR Close #44788
2022-01-25 14:15:45 -08:00
George Kalpakas 6cb7c3ebe3 build(docs-infra): update dgeni-packages to v0.29.3 (#44810)
This version includes angular/dgeni-packages#318 and thus fixes the
rendering of overridden methods in API docs.

Fixes #44468

PR Close #44810
2022-01-25 09:24:41 -08:00
Renovate Bot 966343bb92 build: update angular (#44771)
PR Close #44771
2022-01-25 09:24:00 -08:00
Tim Bowersox 7e93513425 docs: add link to AbstractControlOptions reference (#44764)
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 7c7a1a1724 docs: exclude setValue from async-validator-usage docregion (#44764)
Co-authored-by: Andrew Kushnir <43554145+AndrewKushnir@users.noreply.github.com>
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 62217efb7e docs: add missing return statement to validate() (#44764)
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 1fa14e0c84 docs: remove trailing space in code example (#44764)
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox a71eb4c18e docs: fix UniqueAlterEgoValidatorDirective (#44764)
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox ffd62b9f11 docs: expand async validators in reactive forms (#44764)
* Hone docregions for code examples
* Add more detailed description

PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox e545dd8130 docs: revise text for adding async validators to template-driven forms (#44764)
Co-authored-by: Andrew Kushnir <43554145+AndrewKushnir@users.noreply.github.com>
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 4883b7d9c7 docs: restore UniqueAlterEgoValidator (#44764)
Update the docregion for the directive class to differentiate them

PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 8eb1f76341 docs: fix UniqueAlterEgoValidatorDirective (#44764)
* Use correct class name in providers
* Update parameter & return signature for validate()
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 37bbd97d6e docs: update async validators section (#44764)
* Update the UniqueAlterEgoValidator code example
* Add async-validator docregion to hero-form-reactive.component.2.ts
* Fix typo under Implementing a custom async validator
* Add h3 sections for adding async validators to reactive & template-driven forms
PR Close #44764
2022-01-24 14:53:17 -08:00
Tim Bowersox 9e9e82d7c7 docs: add note about using NG_ASYNC_VALIDATORS (#44764)
When setting up an async validator in a template-driven form, it's necessary to register the directive with NG_ASYNC_VALIDATORS instead of NG_VALIDATORS. This was not mentioned in the docs.
PR Close #44764
2022-01-24 14:53:17 -08:00
Jessica Janiuk e12dfa535b test(animations): Add bundling symbol test for animations package (#44809)
This adds a full bundling animation symbols test to the test suite.

PR Close #44809
2022-01-24 14:52:31 -08:00
iRealNirmal fa7c7afbe9 refactor(forms): update required validator and checkbox validator to inherit abstractValidator (#44162)
Modified required validator and checkbox validator to inherit abstractValidator.

For every validato type different PR will be raised as discussed in #42378.

Closes #42267

PR Close #44162
2022-01-24 14:50:58 -08:00
Kristiyan Kostadinov a4aa9b3c28 Revert "feat(core): allow for injector to be specified when creating an embedded view (#44666)" (#44807)
This reverts commit b49ffcd50e.

PR Close #44807
2022-01-24 12:22:22 -08:00
Kristiyan Kostadinov 40f27a31d2 Revert "feat(common): add injector input to ngTemplateOutlet (#44761)" (#44807)
This reverts commit ed21f5c753.

PR Close #44807
2022-01-24 12:22:22 -08:00
Kristiyan Kostadinov 94bfcdd9de fix(core): error if NgZone.isInAngularZone is called with a noop zone (#44800)
When the user opts into the noop `NgZone`, they usually still interact with the static methods on the non-noop class. This change adds a check to handle the case where zone.js hasn't been loaded.

Fixes #44784.

PR Close #44800
2022-01-24 10:44:44 -08:00
Wiley Marques f0a8303abe docs(router): fixing pathMatch doc to style code correctly (#44796)
PR Close #44796
2022-01-24 10:42:52 -08:00
Andrew Scott abd1bc8039 fix(compiler): correct spans when parsing bindings with comments (#44785)
The previous fix for correcting spans with comments in
https://github.com/angular/angular/commit/59eef29a6c5d568ca80595cd7018e21ad406c85d
had the unfortunate side effect of _breaking_ the spans with comments
when there was leading whitespace. This happened because the previous
fix was testing one without a comment, identifying that the offset shouldn't
have anything added to it, and then removing that offset adjustment
(`offsets[i] + (expressionText.length - sourceToLex.length)`).

Upon further investigation, this offset adjustment _was actually
necessary_ for when the input had comments, but this was only because
the `stripComments` function used `trim` to remove whitespace for these
cases. This is the real problem -- not only does it create a ton of confusion
but also it means that the behavior of the lexer and resulting spans is
different between inputs with comments and inputs without comments.

After reviewing how the `inputLength` of `_ParseAST` was used, it
appears that the correct behavior would be to _not_ trim the input. The
`inputLength` is used to advance the current index beyond points which
have been processed. This _should_ include any whitespace. Additionally,
`inputLength` doesn't appear to be needed at all. When there was no
comment in the input, it was always equal to the `input.length` anyways.
When there _is_ a comment, it should include that comment anyways to
advance the index beyond the comment.

PR Close #44785
2022-01-24 10:41:54 -08:00
Andrew Scott 7316e72ec5 fix(compiler-cli): properly index <svg> elements when on a template (#44785)
The original fix for svg elements in
https://github.com/angular/angular/commit/92b23f48519a1adb460a431c356bcd9917fb059d
did not account for svg elements when they also had a structural
directive on them, making the node a template. This resulted in the
logic added in fix above not being applied.

PR Close #44785
2022-01-24 10:41:54 -08:00
Doug Parker ac2f262e9a docs: add extended diagnostics documentation (#44704)
This includes the initial documentation for extended diagnostics with a page for each of the two initial checks. They follow the same general formula, and hopefully in the future they can be properly generated from metadata rather than copy-pasted as they are currently.

PR Close #44704
2022-01-24 10:41:13 -08:00
George Kalpakas f2fa67eb0b fix(docs-infra): track error docs during serve-and-sync (#44704)
Refs #42966.

Look for changes in error docs (i.e. docs under `aio/content/error/`) in
`authors-package`, so that such docs are tracked when running the
`serve-and-sync` script.

PR Close #44704
2022-01-24 10:41:13 -08:00
George Kalpakas 9bee561956 fix(docs-infra): track error docs during serve-and-sync (#44704)
Refs #42966.

Look for changes in error docs (i.e. docs under `aio/content/error/`) in
`authors-package`, so that such docs are tracked when running the
`serve-and-sync` script.

PR Close #44704
2022-01-24 10:41:13 -08:00
Andrew Kushnir fce521e4d2 release: cut the v13.2.0-rc.1 release (#44804) 2022-01-24 09:41:52 -08:00
Oleg Postoev ade305757b refactor(common): unused return value from attemptFocus (#44457)
The function attemptFocus had a return value that nowhere is used. But it still saves in the bundle.

PR Close #44457
2022-01-21 13:11:32 -08:00
JoostK ed67a074ce fix(compiler): properly compile DI factories when coverage reporting is enabled (#44732)
When running tests with code coverage using Istanbul, the code is
instrumented with coverage reporting statements. These statements are
also inserted into synthesized constructors, preventing Angular from
properly recognizing them as synthesized constructor.

This commit changes the regex to detect synthesized constructors to allow
for statements within the constructor before the `super(...arguments);`
call. This is limited to code that does not contain a `}`, but this
is sufficient to support Istanbul's coverage instrumentation statements.

The tests have been extended with an input file that is being
instrumented using `babel-plugin-istanbul` for both ES2015 and ES5
targets, in order to verify that the approach works for real-world
usages.

Fixes #31337

PR Close #44732
2022-01-21 13:10:43 -08:00
Renovate Bot 43eb934e6b build: update all non-major dependencies (#44713)
PR Close #44713
2022-01-21 11:21:52 -08:00
Douglas Parker d2ae96f742 fix(compiler-cli): skip ExtendedTemplateCheckerImpl construction if there were configuration errors (#44778)
Previously, if a bad extended diagnostic category was given, it would fail with the expected error as well as an unexpected assertion error:

```
$ ng build -c development
✔ Browser application bundle generation complete.

./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Unexpected call to 'assertNever()' with value:
test
    at /home/douglasparker/Source/ng-new/node_modules/@ngtools/webpack/src/ivy/loader.js:77:18
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

./src/polyfills.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy/index.js):
Error: Unexpected call to 'assertNever()' with value:
test
    at /home/douglasparker/Source/ng-new/node_modules/@ngtools/webpack/src/ivy/loader.js:77:18
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Error: error NG4004: Angular compiler option "extendedDiagnostics.checks['invalidBananaInBox']" has an unknown diagnostic category: "test".

Allowed diagnostic categories are:
warning
error
suppress
```

The assertion comes from `ExtendedTemplateCheckerImpl`, which expects a well-formed configuration, yet the compiler would construct it even when errors were found. This commit skips constructing and running extended diagnostics if the configuration had errors, which should avoid triggering these assertion errors.

I'm unfortunately not able to actually test this change. The test passes even before the fix because the `ngc` binary and end-to-end tests [don't request diagnostics unless the configuration is considered valid](https://github.com/angular/angular/blob/ed21f5c75378e1ce717ee3d76d28c8c994209de1/packages/compiler-cli/src/perform_compile.ts#L292-L293). See [Slack](https://angular-team.slack.com/archives/C4WHZQMRA/p1642641305003800) for more details.

PR Close #44778
2022-01-21 11:20:48 -08:00
Andrew Scott 5626b34264 fix(core): consistently use namespace short name rather than URI (#44766)
`Renderer2` APIs expect to be called with the namespace name rather than
the namespace URI. Rather than passing around the URI and having to
account for different calling contexts, this change consistently uses
the namespace short names.

Importantly, the URI was only used in `component_ref.ts` `create`
(because `getNamespace returned the URIs`) and `createElementNode` in
`node_manipulation.ts` (because `getNamespaceUri` also used the URIs).
In contrast, attributes would use the _short names instead of URIs_
(see `setUpAttributes` in `attrs_utils.ts`). These names are pulled
directly from the attribute, i.e. `xhtml:href` and not converted to URI.
This dichotomy is confusing and unnecessary. The change here aligns the two
approaches in order to provide consistently throughout the system.

This relates to #44766 because the `createElementNode` was calling the
`AnimationRenderer.createElement` which delegates to the
`ServerRenderer`, which in turn was only set up to expect short names.
As a result, the `NAMESPACE_URIS` lookup failed and `Domino` created
the `svg` as a regular `Element` which does not have a `styles`
property.

resolves #44766

PR Close #44766
2022-01-21 11:19:31 -08:00
Andrew Scott 1671212a55 test: Update test to not declare component in multiple modules (#44766)
When running locally, these integration tests appear to fail because the
component is declared in many test modules.

PR Close #44766
2022-01-21 11:19:31 -08:00
Doug Parker 100091ebf0 fix(compiler-cli): remove leftover _extendedTemplateDiagnostics requirements (#44777)
Refs #42966.

There were two remaining places where `_extendedTemplateDiagnostics` needed to be set which should have been removed in #44712 but got missed. This updates them to only require `strictTemplates` and not `_extendedTemplateDiagnostics` so the feature is properly enabled in production.

PR Close #44777
2022-01-20 14:03:46 -08:00
Martin Probst b7ff6f06de refactor(compiler): pass rootDir to tsickle (#44768)
tsickle's underlying API has changed to require passing a rootDir to getGeneratedExterns.
PR Close #44768
2022-01-20 11:16:36 -08:00
Stephanie Tuerk 6b75263303 docs: correct (possible) typo (#44759)
change 'reference' to 'referencing' -- I believe this is is a typo and that this is the proper correction.
PR Close #44759
2022-01-20 09:22:37 -08:00
Dylan Hunn caeb162513 release: cut the v13.2.0-rc.0 release (#44765) 2022-01-19 17:36:11 -08:00
485 changed files with 18803 additions and 9090 deletions
+4 -5
View File
@@ -36,7 +36,7 @@ var_4_win: &cache_key_win_fallback v6-angular-win-node-14-{{ checksum "month.txt
# Cache key for the `components-repo-unit-tests` job. **Note** when updating the SHA in the
# cache keys also update the SHA for the "COMPONENTS_REPO_COMMIT" environment variable.
var_5: &components_repo_unit_tests_cache_key v1-angular-components-{{ checksum "month.txt" }}-a931de54a786597b34259e461c2cf3ab6edc590a
var_5: &components_repo_unit_tests_cache_key v1-angular-components-{{ checksum "month.txt" }}-d1cd928714c2d6e3de75f9469ce58b06aad6353c
var_6: &components_repo_unit_tests_cache_key_fallback v1-angular-components-{{ checksum "month.txt" }}
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages`.
@@ -786,10 +786,9 @@ workflows:
# since the publishing script expects the legacy outputs layout.
- build-npm-packages
- legacy-unit-tests-saucelabs
# TODO(devversion): re-enable once the components repo has accounted for the `ng_module` devmode target changes.
#- components-repo-unit-tests:
# requires:
# - build-npm-packages
- components-repo-unit-tests:
requires:
- build-npm-packages
- test_zonejs:
requires:
- setup
+1 -1
View File
@@ -74,7 +74,7 @@ setPublicVar COMPONENTS_REPO_TMP_DIR "/tmp/angular-components-repo"
setPublicVar COMPONENTS_REPO_URL "https://github.com/angular/components.git"
setPublicVar COMPONENTS_REPO_BRANCH "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI `config.yml`.
setPublicVar COMPONENTS_REPO_COMMIT "a931de54a786597b34259e461c2cf3ab6edc590a"
setPublicVar COMPONENTS_REPO_COMMIT "d1cd928714c2d6e3de75f9469ce58b06aad6353c"
####################################################################################################
+1 -1
View File
@@ -9,6 +9,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: angular/dev-infra/github-actions/commit-message-based-labels@744a864cfd77bfe280ac9337041a512cca2daaf9
- uses: angular/dev-infra/github-actions/commit-message-based-labels@fb9b744a4903d0d17e1fccfcdec531cb601b3e47
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
+1 -1
View File
@@ -10,6 +10,6 @@ jobs:
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/feature-request@744a864cfd77bfe280ac9337041a512cca2daaf9
- uses: angular/dev-infra/github-actions/feature-request@fb9b744a4903d0d17e1fccfcdec531cb601b3e47
with:
angular-robot-key: ${{ secrets.ANGULAR_ROBOT_PRIVATE_KEY }}
+1 -1
View File
@@ -10,6 +10,6 @@ jobs:
if: github.repository == 'angular/angular'
runs-on: ubuntu-latest
steps:
- uses: angular/dev-infra/github-actions/lock-closed@744a864cfd77bfe280ac9337041a512cca2daaf9
- uses: angular/dev-infra/github-actions/lock-closed@fb9b744a4903d0d17e1fccfcdec531cb601b3e47
with:
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}
+49
View File
@@ -0,0 +1,49 @@
name: OpenSSF Scorecard
on:
branch_protection_rule:
schedule:
- cron: '0 0 * * 0'
push:
branches: [master]
workflow_dispatch:
# Declare default permissions as read only.
permissions: read-all
jobs:
analysis:
name: Scorecards analysis
runs-on: ubuntu-latest
permissions:
# Needed to upload the results to code-scanning dashboard.
security-events: write
actions: read
contents: read
steps:
- name: 'Checkout code'
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579 # v2.4.0
with:
persist-credentials: false
- name: 'Run analysis'
uses: ossf/scorecard-action@c8416b0b2bf627c349ca92fc8e3de51a64b005cf # v1.0.2
with:
results_file: results.sarif
results_format: sarif
repo_token: ${{ secrets.GITHUB_TOKEN }}
publish_results: true
# Upload the results as artifacts.
- name: 'Upload artifact'
uses: actions/upload-artifact@82c141cc518b40d92cc801eee768e7aafc9c2fa2 # v2.3.1
with:
name: SARIF file
path: results.sarif
retention-days: 5
# Upload the results to GitHub's code scanning dashboard.
- name: 'Upload to code-scanning'
uses: github/codeql-action/upload-sarif@5f532563584d71fdef14ee64d17bafb34f751ce5 # v1.0.26
with:
sarif_file: results.sarif
+7 -1
View File
@@ -30,7 +30,13 @@ export const release: ReleaseConfig = {
return buildTargetPackages('dist/release-output', false, 'Release', /* isRelease */ true);
},
releaseNotes: {
hiddenScopes: ['aio', 'dev-infra', 'docs-infra', 'zone.js'],
hiddenScopes: [
'aio',
'dev-infra',
'docs-infra',
'zone.js',
'devtools',
],
},
releasePrLabels: ['comp: build & ci', 'action: merge', 'PullApprove: disable'],
};
+1
View File
@@ -1271,6 +1271,7 @@ groups:
'docs/NAMING.md',
'aio/content/guide/angular-package-format.md',
'aio/content/errors/*.md',
'aio/content/extended-diagnostics/*.md',
'aio/content/guide/glossary.md',
'aio/content/guide/styleguide.md',
'aio/content/examples/errors/**',
+103 -61
View File
@@ -1,3 +1,106 @@
<a name="13.2.2"></a>
# 13.2.2 (2022-02-08)
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [37af6abb49](https://github.com/angular/angular/commit/37af6abb495a351052389cb095bfbea0260f46c5) | fix | allow banana-in-a-box bindings to end with non-null assertion ([#37809](https://github.com/angular/angular/pull/37809)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [b75e90f809](https://github.com/angular/angular/commit/b75e90f8096394eeef85fa7e667889b7b59a35ed) | fix | incorrectly keeping track of ngModel with ngFor inside a form ([#40459](https://github.com/angular/angular/pull/40459)) |
### http
| Commit | Type | Description |
| -- | -- | -- |
| [3fae6637e7](https://github.com/angular/angular/commit/3fae6637e7d379a9dd1862555ec7e586f80be4c9) | perf | remove IE special status handling ([#44354](https://github.com/angular/angular/pull/44354)) |
### upgrade
| Commit | Type | Description |
| -- | -- | -- |
| [b9aab0c87b](https://github.com/angular/angular/commit/b9aab0c87bcccb61167e92c1e910630afad67648) | fix | Do not trigger duplicate navigation events from Angular Router ([#43441](https://github.com/angular/angular/pull/43441)) |
## Special Thanks
Alan Agius, Alan Cohen, Andrew Kushnir, Andrew Scott, Daniel Díaz, Dario Piotrowicz, Doug Parker, Jayson Acosta, Joey Perrott, JoostK, Kristiyan Kostadinov, Olivier Capuozzo, Ramzan, Shai Reznik, TANMAY SRIVASTAVA, dario-piotrowicz, iRealNirmal, jhonyeduardo, mgechev and zuckjet
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.2.1"></a>
# 13.2.1 (2022-02-02)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [4644886aaf](https://github.com/angular/angular/commit/4644886aaf96c9da513cc7a2c2568254a11c8a4b) | perf | remove no longer needed CssKeyframes classes ([#44903](https://github.com/angular/angular/pull/44903)) ([#44919](https://github.com/angular/angular/pull/44919)) |
### common
| Commit | Type | Description |
| -- | -- | -- |
| [b4e4617807](https://github.com/angular/angular/commit/b4e4617807a8ef97b6423e6debfe504f86aa506c) | fix | include query parameters for open HTTP requests in `verify` ([#44917](https://github.com/angular/angular/pull/44917)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [0778e6f7d7](https://github.com/angular/angular/commit/0778e6f7d79080124c240122acd9ff5ffffc74f5) | fix | accept nullish coalescing operator for any and unknown types ([#44862](https://github.com/angular/angular/pull/44862)) |
| [07185f4ed1](https://github.com/angular/angular/commit/07185f4ed1ac7071af62a65d8a5391ca28b03205) | fix | enable nullish coalescing check only with `strictNullChecks` ([#44862](https://github.com/angular/angular/pull/44862)) |
| [4a5ad1793f](https://github.com/angular/angular/commit/4a5ad1793f91ef5375146b4ead9929c8a939746e) | fix | ensure casing of logical paths is preserved ([#44798](https://github.com/angular/angular/pull/44798)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [7ec482d9c2](https://github.com/angular/angular/commit/7ec482d9c2292d6370f7a2da9addf2abb8bb21bb) | fix | Add back support for namespace URIs in createElement of dom renderer ([#44914](https://github.com/angular/angular/pull/44914)) |
| [250dc40a46](https://github.com/angular/angular/commit/250dc40a46797446bf3328a58b9b1a4d8057b1d6) | fix | flush delayed scoping queue while setting up TestBed ([#44814](https://github.com/angular/angular/pull/44814)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [1aebbf8714](https://github.com/angular/angular/commit/1aebbf8714b9cd3c3b5844065c5b64240c05b37d) | fix | ensure OnPush ancestors are marked dirty when the promise resolves ([#44886](https://github.com/angular/angular/pull/44886)) |
| [6b7fffcbeb](https://github.com/angular/angular/commit/6b7fffcbeb08ce77aef1d83de354ca7266600c6f) | fix | Update the typed forms migration schematic to find all files. ([#44881](https://github.com/angular/angular/pull/44881)) |
## Special Thanks
Alan, Andrew Kushnir, Andrew Scott, Aristeidis Bampakos, Arjen, Daniel Díaz, David Shevitz, Doug Parker, Dylan Hunn, Esteban Gehring, George Kalpakas, Jessica Janiuk, JoostK, Juri Strumpflohner, Lee Robinson, Maarten Tibau, Paul Gschwendtner, Theodore Brown, arturovt, dario-piotrowicz, fru2, markostanimirovic and mgechev
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.2.0"></a>
# 13.2.0 (2022-01-26)
## Deprecations
###
- The `CachedResourceLoader` and `RESOURCE_CACHE_PROVIDER` symbols were previously necessary in some cases to test AOT-compiled components with View Engine, but they are no longer needed since Ivy.
- The `ComponentFactory` and `ComponentFactoryResolver` classes are deprecated. Since Ivy, there is no need to resolve Component factories. Please use other APIs where you Component classes can be used directly (without resolving their factories).
- Since Ivy, the `CompilerOptions.useJit` and `CompilerOptions.missingTranslation` config options are unused, passing them has no effect.
###
| Commit | Type | Description |
| -- | -- | -- |
| [9c11183e74](https://github.com/angular/angular/commit/9c11183e74980b12c3c5712df174e90af6f19027) | docs | deprecate `CachedResourceLoader` and `RESOURCE_CACHE_PROVIDER` symbols ([#44749](https://github.com/angular/angular/pull/44749)) |
| [9f12e7fea4](https://github.com/angular/angular/commit/9f12e7fea434c6d33e1155994e2c228d51520744) | docs | deprecate `ComponentFactory` and `ComponentFactoryResolver` symbols ([#44749](https://github.com/angular/angular/pull/44749)) |
| [4e95a316ce](https://github.com/angular/angular/commit/4e95a316cef35a771cd8168e3a744eb6bd7f1615) | docs | deprecate unused config options from the `CompilerOptions` interface ([#44749](https://github.com/angular/angular/pull/44749)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [a4ab6d6b72](https://github.com/angular/angular/commit/a4ab6d6b72fe891f232d2446f8b7c454a82a5ba0) | feat | add support for safe calls in templates ([#44580](https://github.com/angular/angular/pull/44580)) |
| [abd1bc8039](https://github.com/angular/angular/commit/abd1bc8039ade4324f91fd616c82e52f05bdbb70) | fix | correct spans when parsing bindings with comments ([#44785](https://github.com/angular/angular/pull/44785)) |
| [ed67a074ce](https://github.com/angular/angular/commit/ed67a074ceed6440bf7f638512a20bbd3be8cbd4) | fix | properly compile DI factories when coverage reporting is enabled ([#44732](https://github.com/angular/angular/pull/44732)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [fa835b5a29](https://github.com/angular/angular/commit/fa835b5a297087087eac2750b662096ed5492cb6) | feat | enable extended diagnostics by default ([#44712](https://github.com/angular/angular/pull/44712)) |
| [73424def13](https://github.com/angular/angular/commit/73424def130ae1d72036142f6f2d7bce63858c9e) | feat | provide the animations for `DirectiveMeta` ([#44630](https://github.com/angular/angular/pull/44630)) |
| [fe3e4d6865](https://github.com/angular/angular/commit/fe3e4d6865c1e760be0511cfd757b4574a67fa5b) | fix | Handle `ng-template` with structural directive in indexer ([#44788](https://github.com/angular/angular/pull/44788)) |
| [7316e72ec5](https://github.com/angular/angular/commit/7316e72ec5ccc475e610bf26b5da451b8ffa50a2) | fix | properly index <svg> elements when on a template ([#44785](https://github.com/angular/angular/pull/44785)) |
| [100091ebf0](https://github.com/angular/angular/commit/100091ebf0ad480e94b5db4f183f9bfcfe8b8274) | fix | remove leftover `_extendedTemplateDiagnostics` requirements ([#44777](https://github.com/angular/angular/pull/44777)) |
| [d2ae96f742](https://github.com/angular/angular/commit/d2ae96f742c82daa6c4d4b8afd3b0959fb9b89d1) | fix | skip `ExtendedTemplateCheckerImpl` construction if there were configuration errors ([#44778](https://github.com/angular/angular/pull/44778)) |
### core
| Commit | Type | Description |
| -- | -- | -- |
| [5626b34264](https://github.com/angular/angular/commit/5626b34264d8893fece74d30db4920a685f3b17f) | fix | consistently use namespace short name rather than URI ([#44766](https://github.com/angular/angular/pull/44766)) |
| [94bfcdd9de](https://github.com/angular/angular/commit/94bfcdd9de234f7189daaa06a6c179d9697bef8d) | fix | error if NgZone.isInAngularZone is called with a noop zone ([#44800](https://github.com/angular/angular/pull/44800)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [72092ebd26](https://github.com/angular/angular/commit/72092ebd26d6670a7dd02f6db5515d2afd27c4d6) | feat | Allow a FormControl to use initial value as default. ([#44434](https://github.com/angular/angular/pull/44434)) |
| [f7aa937cac](https://github.com/angular/angular/commit/f7aa937cac0ad315e1012770aa1da97476aced54) | fix | Make some minor fixups for forward-compatibility with typed forms. ([#44540](https://github.com/angular/angular/pull/44540)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [5a4ddfd4f5](https://github.com/angular/angular/commit/5a4ddfd4f5e17bb4209528cefc3f0674298ab6e8) | feat | Allow symbol keys for `Route` `data` and `resolve` properties ([#44519](https://github.com/angular/angular/pull/44519)) |
## Special Thanks
Alex Rickabaugh, Andrew Kushnir, Andrew Scott, Dario Piotrowicz, Derek Cormier, Doug Parker, Douglas Parker, Dylan Hunn, George Kalpakas, Jessica Janiuk, JoostK, Kristiyan Kostadinov, Martin Probst, Oleg Postoev, Stephanie Tuerk, Tim Bowersox, Wiley Marques, Yousaf Nawaz, dario-piotrowicz, iRealNirmal, ivanwonder and shejialuo
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.1.3"></a>
# 13.1.3 (2022-01-19)
### animations
@@ -17,44 +120,6 @@ Alan Agius, Andrew Kushnir, AnkitSharma-007, Daniel Díaz, Dmytro Mezhenskyi, Je
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.2.0-next.2"></a>
# 13.2.0-next.2 (2022-01-12)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [8ba43a1a1e](https://github.com/angular/angular/commit/8ba43a1a1ea811ad25d6af4384e1cce5a53b0baf) | fix | retain triggers values for moved tracked list items ([#44578](https://github.com/angular/angular/pull/44578)) |
### compiler
| Commit | Type | Description |
| -- | -- | -- |
| [a4ab6d6b72](https://github.com/angular/angular/commit/a4ab6d6b72fe891f232d2446f8b7c454a82a5ba0) | feat | add support for safe calls in templates ([#44580](https://github.com/angular/angular/pull/44580)) |
| [b8ed03b5ad](https://github.com/angular/angular/commit/b8ed03b5ad91a2dd62d600240e9056a360b89b90) | fix | correct spans when parsing bindings with comments ([#44678](https://github.com/angular/angular/pull/44678)) |
### compiler-cli
| Commit | Type | Description |
| -- | -- | -- |
| [73424def13](https://github.com/angular/angular/commit/73424def130ae1d72036142f6f2d7bce63858c9e) | feat | provide the animations for `DirectiveMeta` ([#44630](https://github.com/angular/angular/pull/44630)) |
| [1a9121826e](https://github.com/angular/angular/commit/1a9121826ea94d98d0603d65628d4b4b08f2f70b) | fix | enable narrowing of using type guard methods ([#44447](https://github.com/angular/angular/pull/44447)) |
| [f8af49eb75](https://github.com/angular/angular/commit/f8af49eb751cabab76c6c7327f377a163f841dc4) | fix | fix crash during type-checking of library builds ([#44587](https://github.com/angular/angular/pull/44587)) |
| [f83fb3a5f9](https://github.com/angular/angular/commit/f83fb3a5f9b146cb5025517950100e98895304ed) | fix | handle property reads of `ThisReceiver` in the indexer ([#44678](https://github.com/angular/angular/pull/44678)) |
| [eeaabe7fbf](https://github.com/angular/angular/commit/eeaabe7fbf7a1cf057c6b740609886415e4037eb) | fix | incorrectly interpreting $any calls with a property read ([#44657](https://github.com/angular/angular/pull/44657)) |
| [92b23f4851](https://github.com/angular/angular/commit/92b23f48519a1adb460a431c356bcd9917fb059d) | fix | properly index <svg> elements ([#44678](https://github.com/angular/angular/pull/44678)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [5ae1030462](https://github.com/angular/angular/commit/5ae1030462a97bda8357415cbfcd34301dfa6499) | feat | Add an unused symbol `AnyForUntypedForms`. ([#44467](https://github.com/angular/angular/pull/44467)) |
| [f7aa937cac](https://github.com/angular/angular/commit/f7aa937cac0ad315e1012770aa1da97476aced54) | fix | Make some minor fixups for forward-compatibility with typed forms. ([#44540](https://github.com/angular/angular/pull/44540)) |
### language-service
| Commit | Type | Description |
| -- | -- | -- |
| [af2a1317cb](https://github.com/angular/angular/commit/af2a1317cbfba985233f510bbe9e49016968307c) | feat | support completions for animation ([#44630](https://github.com/angular/angular/pull/44630)) |
### router
| Commit | Type | Description |
| -- | -- | -- |
| [5a4ddfd4f5](https://github.com/angular/angular/commit/5a4ddfd4f5e17bb4209528cefc3f0674298ab6e8) | feat | Allow symbol keys for `Route` `data` and `resolve` properties ([#44519](https://github.com/angular/angular/pull/44519)) |
## Special Thanks
Abdurrahman Abu-Hijleh, Adam Plumer, Alex Rickabaugh, AlirezaEbrahimkhani, Andrew Kushnir, Andrew Scott, Borja Paz Rodríguez, Chihab Otmani, Chris Mancini, Dario Piotrowicz, Doug Parker, Dylan Hunn, George Kalpakas, Joey Perrott, JoostK, Kristiyan Kostadinov, Kyoz, Patrick Prakash, Paul Gschwendtner, Serhey Dolgushev, Yousaf Nawaz, Yuchao Wu, alkavats1, dario-piotrowicz, huangqing, ivanwonder, shejialuo, twerske, wszgrcy and zuckjet
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.1.2"></a>
# 13.1.2 (2022-01-12)
### animations
@@ -82,22 +147,6 @@ Abdurrahman Abu-Hijleh, Adam Plumer, Alex Rickabaugh, AlirezaEbrahimkhani, Andre
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.2.0-next.1"></a>
# 13.2.0-next.1 (2021-12-15)
### animations
| Commit | Type | Description |
| -- | -- | -- |
| [38ddae1c2e](https://github.com/angular/angular/commit/38ddae1c2e0de87d5672fda30d4fbe567dab4123) | fix | don't consume instructions for animateChild ([#44357](https://github.com/angular/angular/pull/44357)) |
| [bab7ed3541](https://github.com/angular/angular/commit/bab7ed35418173714509e06ba8b092aff28fff89) | fix | should not invoke disabled child animations ([#37724](https://github.com/angular/angular/pull/37724)) |
### forms
| Commit | Type | Description |
| -- | -- | -- |
| [72092ebd26](https://github.com/angular/angular/commit/72092ebd26d6670a7dd02f6db5515d2afd27c4d6) | feat | Allow a FormControl to use initial value as default. ([#44434](https://github.com/angular/angular/pull/44434)) |
## Special Thanks
Alex Rickabaugh, Aristeidis Bampakos, Dylan Hunn, JoostK, Kristiyan Kostadinov, Paul Gschwendtner, Spej, Yousaf Nawaz, dario-piotrowicz, faso-dev, jaybell and zuckjet
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.1.1"></a>
# 13.1.1 (2021-12-15)
### animations
@@ -115,13 +164,6 @@ Aristeidis Bampakos, Dylan Hunn, George Kalpakas, JoostK, Kristiyan Kostadinov,
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.2.0-next.0"></a>
# 13.2.0-next.0 (2021-12-09)
There have been no changes since the previous `13.1.0` release.
<!-- CHANGELOG SPLIT MARKER -->
<a name="13.1.0"></a>
# 13.1.0 (2021-12-09)
## Deprecations
+3 -3
View File
@@ -16,10 +16,10 @@ http_archive(
# rule in `@bazel_tools` is not Windows compatible and outdated.
http_archive(
name = "rules_pkg",
sha256 = "a89e203d3cf264e564fcb96b6e06dd70bc0557356eb48400ce4b5d97c2c3720d",
sha256 = "62eeb544ff1ef41d786e329e1536c1d541bb9bcad27ae984d57f18f314018e66",
urls = [
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.5.1/rules_pkg-0.5.1.tar.gz",
"https://mirror.bazel.build/github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
"https://github.com/bazelbuild/rules_pkg/releases/download/0.6.0/rules_pkg-0.6.0.tar.gz",
],
)
+1 -1
View File
@@ -1,6 +1,6 @@
# Angular documentation project (https://angular.io)
Everything in this folder is part of the documentation project. This includes
Everything in this folder is part of the documentation project. This includes:
* the web site for displaying the documentation
* the dgeni configuration for converting source files to rendered files that can be viewed in the web site.
@@ -1,5 +1,6 @@
// Imports
import fetch from 'node-fetch';
import {assertNotMissingOrEmpty} from './utils';
// Constants
@@ -22,8 +23,8 @@ export interface BuildInfo {
username: string;
build_num: number;
has_artifacts: boolean;
outcome: string; // e.g. 'success'
vcs_revision: string; // HEAD SHA
outcome: string; // e.g. 'success'
vcs_revision: string; // HEAD SHA
// there are other fields but they are not used in this code
}
@@ -31,19 +32,19 @@ export interface BuildInfo {
* A Helper that can interact with the CircleCI API.
*/
export class CircleCiApi {
private tokenParam = `circle-token=${this.circleCiToken}`;
/**
* Construct a helper that can interact with the CircleCI REST API.
* @param githubOrg The Github organisation whose repos we want to access in CircleCI (e.g. angular).
* @param githubOrg The Github organisation whose repos we want to access in CircleCI (e.g.
* angular).
* @param githubRepo The Github repo whose builds we want to access in CircleCI (e.g. angular).
* @param circleCiToken The CircleCI API access token (secret).
*/
constructor(
private githubOrg: string,
private githubRepo: string,
private circleCiToken: string,
private githubOrg: string,
private githubRepo: string,
private circleCiToken: string,
) {
assertNotMissingOrEmpty('githubOrg', githubOrg);
assertNotMissingOrEmpty('githubRepo', githubRepo);
@@ -64,7 +65,7 @@ export class CircleCiApi {
}
return response.json();
} catch (error) {
throw new Error(`CircleCI build info request failed (${error.message})`);
throw new Error(`CircleCI build info request failed (${(error as Error).message})`);
}
}
@@ -84,7 +85,7 @@ export class CircleCiApi {
}
return artifact.url;
} catch (error) {
throw new Error(`CircleCI artifact URL request failed (${error.message})`);
throw new Error(`CircleCI artifact URL request failed (${(error as Error).message})`);
}
}
}
@@ -1,4 +1,5 @@
import {basename, resolve as resolvePath} from 'path';
import {SHORT_SHA_LEN} from './constants';
/**
@@ -17,7 +18,8 @@ export function computeShortSha(sha: string) {
* @param artifactPath The path to the artifact on CircleCI.
* @returns The fully resolved location for the specified downloaded artifact.
*/
export function computeArtifactDownloadPath(downloadsDir: string, pr: number, sha: string, artifactPath: string) {
export function computeArtifactDownloadPath(
downloadsDir: string, pr: number, sha: string, artifactPath: string) {
return resolvePath(downloadsDir, `${pr}-${computeShortSha(sha)}-${basename(artifactPath)}`);
}
@@ -48,7 +50,7 @@ export function assert(value: boolean, message: string) {
* @param name The name of the parameter.
* @param value The value of the parameter.
*/
export const assertNotMissingOrEmpty = (name: string, value: string | null | undefined) => {
export const assertNotMissingOrEmpty = (name: string, value: string|null|undefined) => {
assert(!!value, `Missing or empty required parameter '${name}'!`);
};
@@ -64,9 +66,9 @@ export const getEnvVar = (name: string, isOptional = false): string => {
if (!isOptional && !value) {
try {
throw new Error(`ERROR: Missing required environment variable '${name}'!`);
throw new Error(`ERROR: Missing required environment variable '${name}'!`);
} catch (error) {
console.error(error.stack);
console.error((error as Error).stack);
process.exit(1);
}
}
@@ -76,7 +78,8 @@ export const getEnvVar = (name: string, isOptional = false): string => {
/**
* A basic logger implementation.
* Delegates to `console`, but prepends each message with the current date and specified scope (i.e caller).
* Delegates to `console`, but prepends each message with the current date and specified scope (i.e
* caller).
*/
export class Logger {
private padding = ' '.repeat(20 - this.scope.length);
@@ -87,12 +90,20 @@ export class Logger {
*/
constructor(private scope: string) {}
public error(...args: any[]) { this.callMethod('error', args); }
public info(...args: any[]) { this.callMethod('info', args); }
public log(...args: any[]) { this.callMethod('log', args); }
public warn(...args: any[]) { this.callMethod('warn', args); }
public error(...args: any[]) {
this.callMethod('error', args);
}
public info(...args: any[]) {
this.callMethod('info', args);
}
public log(...args: any[]) {
this.callMethod('log', args);
}
public warn(...args: any[]) {
this.callMethod('warn', args);
}
private callMethod(method: 'error' | 'info' | 'log' | 'warn', args: any[]) {
private callMethod(method: 'error'|'info'|'log'|'warn', args: any[]) {
console[method](`[${new Date()}]`, `${this.scope}:${this.padding}`, ...args);
}
}
@@ -3,8 +3,10 @@ import fetch from 'node-fetch';
import {dirname} from 'path';
import {mkdir} from 'shelljs';
import {promisify} from 'util';
import {CircleCiApi} from '../common/circle-ci-api';
import {assert, assertNotMissingOrEmpty, computeArtifactDownloadPath, Logger} from '../common/utils';
import {PreviewServerError} from './preview-error';
export interface GithubInfo {
@@ -20,8 +22,11 @@ export interface GithubInfo {
*/
export class BuildRetriever {
private logger = new Logger('BuildRetriever');
constructor(private api: CircleCiApi, private downloadSizeLimit: number, private downloadDir: string) {
assert(downloadSizeLimit > 0, 'Invalid parameter "downloadSizeLimit" should be a number greater than 0.');
constructor(
private api: CircleCiApi, private downloadSizeLimit: number, private downloadDir: string) {
assert(
downloadSizeLimit > 0,
'Invalid parameter "downloadSizeLimit" should be a number greater than 0.');
assertNotMissingOrEmpty('downloadDir', downloadDir);
}
@@ -50,25 +55,29 @@ export class BuildRetriever {
* @param artifactPath the path on CircleCI where the artifact was stored.
* @returns A promise to the file path where the downloaded file was stored.
*/
public async downloadBuildArtifact(buildNum: number, pr: number, sha: string, artifactPath: string): Promise<string> {
public async downloadBuildArtifact(
buildNum: number, pr: number, sha: string, artifactPath: string): Promise<string> {
try {
const outPath = computeArtifactDownloadPath(this.downloadDir, pr, sha, artifactPath);
const downloadExists = await new Promise(resolve => fs.exists(outPath, exists => resolve(exists)));
const downloadExists =
await new Promise(resolve => fs.exists(outPath, exists => resolve(exists)));
if (!downloadExists) {
const url = await this.api.getBuildArtifactUrl(buildNum, artifactPath);
const response = await fetch(url, {size: this.downloadSizeLimit});
if (response.status !== 200) {
throw new PreviewServerError(response.status, `Error ${response.status} - ${response.statusText}`);
throw new PreviewServerError(
response.status, `Error ${response.status} - ${response.statusText}`);
}
const buffer = await response.buffer();
mkdir('-p', dirname(outPath));
await promisify(fs.writeFile)(outPath, buffer);
}
return outPath;
} catch (error) {
} catch (error: any) {
this.logger.warn(error);
const status = (error.type === 'max-size') ? 413 : 500;
throw new PreviewServerError(status, `CircleCI artifact download failed (${error.message || error})`);
throw new PreviewServerError(
status, `CircleCI artifact download failed (${error.message || error})`);
}
}
}
@@ -1,4 +1,5 @@
import * as express from 'express';
import {PreviewServerError} from '../../lib/preview-server/preview-error';
import {respondWithError, throwRequestError} from '../../lib/preview-server/utils';
@@ -37,11 +38,12 @@ describe('preview-server/utils', () => {
originalUrl: 'some.domain.com/path',
} as express.Request;
throwRequestError(505, 'ERROR MESSAGE', request);
} catch (error) {
} catch (error: any) {
caught = true;
expect(error).toBeInstanceOf(PreviewServerError);
expect(error.status).toEqual(505);
expect(error.message).toEqual(`ERROR MESSAGE in request: POST some.domain.com/path "The request body"`);
expect(error.message)
.toEqual(`ERROR MESSAGE in request: POST some.domain.com/path "The request body"`);
}
expect(caught).toEqual(true);
});
@@ -1,40 +1,36 @@
{
"compilerOptions": {
/* Basic Options */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', or 'ESNEXT'. */
"module": "commonjs", /* Specify module code generation: 'none', commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
"lib": [
"es2015",
"es2016.array.include"
], /* Specify library files to be included in the compilation: */
], /* Specify library files to be included in the compilation: */
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true, /* Report errors in .js files. */
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
// "declaration": true, /* Generates corresponding '.d.ts' file. */
// "sourceMap": true, /* Generates corresponding '.map' file. */
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "dist", /* Redirect output structure to the directory. */
"outDir": "dist", /* Redirect output structure to the directory. */
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
"importHelpers": true, /* Import emit helpers from 'tslib'. */
"importHelpers": true, /* Import emit helpers from 'tslib'. */
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
/* Strict Type-Checking Options */
"strict": true, /* Enable all strict type-checking options. */
"strict": true, /* Enable all strict type-checking options. */
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noUnusedLocals": true, /* Report errors on unused locals. */
"noUnusedParameters": true, /* Report errors on unused parameters. */
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
"useUnknownInCatchVariables": false, /* Avoid having to cast error objects inside `catch` clauses. */
/* Module Resolution Options */
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
@@ -42,29 +38,26 @@
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
"typeRoots": [
"node_modules/@types"
], /* List of folders to include type definitions from. */
], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "./", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "./", /* Specify the location where debugger should locate map files instead of generated locations. */
"inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
"inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
/* Other */
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
"newLine": "LF", /* Use the specified end of line sequence to be used when emitting files: "crlf" (windows) or "lf" (unix). */
"pretty": true, /* Stylize errors and messages using color and context. */
"skipLibCheck": true /* Skip type checking of all declaration files (*.d.ts). */
"newLine": "LF", /* Use the specified end of line sequence to be used when emitting files: "crlf" (windows) or "lf" (unix). */
"pretty": true, /* Stylize errors and messages using color and context. */
"skipLibCheck": true /* Skip type checking of all declaration files (*.d.ts). */
},
"include": [
"lib/**/*",
"test/**/*"
]
}
}
+1 -1
View File
@@ -69,7 +69,7 @@ rm -rf .angular/cache
To clear the cache on Windows:
```bash
rmdir /s /q .angular/cache
rmdir /s /q .angular\cache
```
For more information, see [rm command](https://man7.org/linux/man-pages/man1/rm.1.html) and [rmdir command](https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/rmdir).
+4 -4
View File
@@ -13,12 +13,12 @@
"plugin:@angular-eslint/template/recommended"
],
"rules": {
"@angular-eslint/template/accessibility-alt-text": "off", // TODO: Fix the code violating this rule and enable it.
"@angular-eslint/template/accessibility-elements-content": "off", // TODO: Fix the code violating this rule and enable it.
"@angular-eslint/template/accessibility-label-has-associated-control": "off", // TODO: Fix the code violating this rule and enable it.
"@angular-eslint/template/accessibility-alt-text": "error",
"@angular-eslint/template/accessibility-elements-content": "error",
"@angular-eslint/template/accessibility-label-has-associated-control": "error",
"@angular-eslint/template/accessibility-table-scope": "error",
"@angular-eslint/template/accessibility-valid-aria": "error",
"@angular-eslint/template/click-events-have-key-events": "off", // TODO: Fix the code violating this rule and enable it.
"@angular-eslint/template/click-events-have-key-events": "error",
"@angular-eslint/template/eqeqeq": "off",
"@angular-eslint/template/mouse-events-have-key-events": "error",
"@angular-eslint/template/no-autofocus": "error",
@@ -38,11 +38,11 @@
<p></p>
<div>
<!-- #docregion event-binding -->
<button (click)="toggleImage()">
<button type="button" (click)="toggleImage()">
<!-- #enddocregion event-binding -->
Image Toggle #1</button>
<!-- #docregion event-binding -->
<button (click)="toggleImage($event)">
<button type="button" (click)="toggleImage($event)">
<!-- #enddocregion event-binding -->
Image Toggle #2</button>
<p>Image toggle event type was {{eventType}}</p>
@@ -51,7 +51,7 @@
<p></p>
<div *ngIf="showImage">
<!-- #docregion src -->
<img [src]="movie.imageurl">
<img [src]="movie.imageurl" [alt]="movie.title">
<!-- #enddocregion src -->
</div>
@@ -39,7 +39,7 @@
<thead>
<tr>
<th>
<button (click)="toggleImage()">
<button type="button" (click)="toggleImage()">
{{showImage ? "Hide" : "Show"}} Poster
</button>
</th>
@@ -61,6 +61,7 @@
[style.height.px]="50"
[style.margin.px]="2"
[src]="movie.imageurl"
[alt]="movie.title"
[title]="movie.title">
</td>
<td>{{movie.title}}</td>
@@ -1,9 +1,9 @@
<ul class="heroes">
<li *ngFor="let hero of heroes"
[@shrinkOut]="'in'" (click)="removeHero(hero.id)">
<div class="inner">
[@shrinkOut]="'in'">
<button class="inner" type="button" (click)="removeHero(hero.id)">
<span class="badge">{{ hero.id }}</span>
<span>{{ hero.name }}</span>
</div>
<span class="name">{{ hero.name }}</span>
</button>
</li>
</ul>
</ul>
@@ -19,11 +19,11 @@ import { Hero } from './hero';
template: `
<ul class="heroes">
<li *ngFor="let hero of heroes"
[@flyInOut]="'in'" (click)="removeHero(hero.id)">
<div class="inner">
[@flyInOut]="'in'">
<button class="inner" type="button" (click)="removeHero(hero.id)">
<span class="badge">{{ hero.id }}</span>
<span>{{ hero.name }}</span>
</div>
<span class="name">{{ hero.name }}</span>
</button>
</li>
</ul>
`,
@@ -19,12 +19,11 @@ import { Hero } from './hero';
selector: 'app-hero-list-groups',
template: `
<ul class="heroes">
<li *ngFor="let hero of heroes"
[@flyInOut]="'in'" (click)="removeHero(hero.id)">
<div class="inner">
<li *ngFor="let hero of heroes" [@flyInOut]="'in'">
<button class="inner" type="button" (click)="removeHero(hero.id)">
<span class="badge">{{ hero.id }}</span>
<span>{{ hero.name }}</span>
</div>
<span class="name">{{ hero.name }}</span>
</button>
</li>
</ul>
`,
@@ -33,7 +32,7 @@ import { Hero } from './hero';
animations: [
trigger('flyInOut', [
state('in', style({
width: 120,
width: '*',
transform: 'translateX(0)', opacity: 1
})),
transition(':enter', [
@@ -41,7 +40,7 @@ import { Hero } from './hero';
group([
animate('0.3s 0.1s ease', style({
transform: 'translateX(0)',
width: 120
width: '*'
})),
animate('0.3s ease', style({
opacity: 1
@@ -1,25 +1,56 @@
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.heroes li {
overflow:hidden;
margin: .5em 0;
display: flex;
align-items: center;
width: 100%;
overflow: hidden;
}
.heroes li > .inner {
cursor: pointer;
.heroes .inner {
flex: 1;
background-color: #EEE;
padding: .3rem 0;
height: 1.6rem;
margin: .5em;
padding: 0;
border-radius: 4px;
display: flex;
align-items: stretch;
}
.heroes li:hover > .inner {
color: black;
background-color: #DDD;
transform: translateX(.1em);
.heroes button.inner {
cursor: pointer;
font-size: inherit;
}
.heroes button.inner:hover {
color: #2c3a41;
background-color: #e6e6e6;
left: .1em;
}
.heroes button.inner:active {
background-color: #525252;
color: #fafafa;
}
.heroes button.inner.selected {
background-color: black;
color: white;
}
.heroes button.inner.selected:hover {
background-color: #505050;
color: white;
}
.heroes button.inner.selected:active {
background-color: black;
color: white;
}
.heroes .badge {
@@ -27,17 +58,17 @@
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #3d5157;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
min-width: 16px;
text-align: right;
background-color: #405061;
line-height: 1em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
.heroes .name {
min-width: max-content;
padding: 0.5rem 0;
}
label {
display: block;
padding-bottom: .5rem;
@@ -11,7 +11,7 @@
<li *ngFor="let hero of heroes" class="hero">
<div class="inner">
<span class="badge">{{ hero.id }}</span>
<span>{{ hero.name }}</span>
<span class="name">{{ hero.name }}</span>
</div>
</li>
</ul>
@@ -3,7 +3,7 @@
<h2>Insert/Remove</h2>
<nav>
<button (click)="toggle()">Toggle Insert/Remove</button>
<button type="button" (click)="toggle()">Toggle Insert/Remove</button>
</nav>
<!-- #docregion insert-remove-->
@@ -1,7 +1,7 @@
<!-- #docplaster -->
<!-- #docregion trigger -->
<nav>
<button (click)="toggle()">Toggle Open/Close</button>
<button type="button" (click)="toggle()">Toggle Open/Close</button>
</nav>
<div [@openClose]="isOpen ? 'open' : 'closed'" class="open-close-container">
@@ -1,6 +1,6 @@
<!-- #docplaster -->
<nav>
<button (click)="toggle()">Toggle Boolean/Close</button>
<button type="button" (click)="toggle()">Toggle Boolean/Close</button>
</nav>
<!-- #docregion trigger-boolean -->
@@ -1,6 +1,6 @@
<!-- #docplaster -->
<nav>
<button (click)="toggle()">Toggle Open/Close</button>
<button type="button" (click)="toggle()">Toggle Open/Close</button>
</nav>
<!-- #docregion callbacks -->
@@ -1,6 +1,6 @@
<nav>
<button (click)="toggleAnimations()">Toggle Animations</button>
<button (click)="toggle()">Toggle Open/Closed</button>
<button type="button" (click)="toggleAnimations()">Toggle Animations</button>
<button type="button" (click)="toggle()">Toggle Open/Closed</button>
</nav>
<!-- #docregion toggle-animation -->
<div [@.disabled]="isDisabled">
@@ -1,4 +1,4 @@
<button (click)="toggle()">Toggle Open/Close</button>
<button type="button" (click)="toggle()">Toggle Open/Close</button>
<div [@openClose]="isOpen ? 'open' : 'closed'"
(@openClose.start)="onAnimationEvent($event)"
@@ -1,5 +1,5 @@
<nav>
<button (click)="toggle()">Toggle Status</button>
<button type="button" (click)="toggle()">Toggle Status</button>
</nav>
<div [@slideStatus]="status" class="box">
@@ -1,7 +1,8 @@
<!--#docregion binding -->
<li>{{hero.name}}</li>
<app-hero-detail [hero]="selectedHero"></app-hero-detail>
<li (click)="selectHero(hero)"></li>
<button type="button" (click)="selectHero(hero)">
{{hero.name}}
</button>
<!--#enddocregion binding -->
<!--#docregion structural -->
@@ -3,8 +3,10 @@
<p><em>Select a hero from the list to see details.</em></p>
<ul>
<li *ngFor="let hero of heroes" (click)="selectHero(hero)">
{{hero.name}}
<li *ngFor="let hero of heroes">
<button type="button" (click)="selectHero(hero)">
{{hero.name}}
</button>
</li>
</ul>
@@ -4,13 +4,21 @@ ul {
li {
list-style-type: none;
padding: 1rem;
background-color: aliceblue;
border: 1px solid #444;
margin-bottom: .5rem;
display: flex;
}
li:hover {
li button {
background-color: aliceblue;
flex: 1;
padding: 1rem;
margin: 0;
text-align: left;
border-radius: 0;
}
li button:hover, li button:active {
background-color: #444;
color: white;
cursor: pointer;
@@ -21,7 +21,7 @@
<div>
<!-- #docregion attrib-binding-aria -->
<!-- create and set an aria attribute for assistive technology -->
<button [attr.aria-label]="actionName">{{actionName}} with Aria</button>
<button type="button" [attr.aria-label]="actionName">{{actionName}} with Aria</button>
<!-- #enddocregion attrib-binding-aria -->
</div>
@@ -7,7 +7,7 @@
<h2>Button disabled state bound to isUnchanged property</h2>
<!-- #docregion disabled-button -->
<!-- Bind button disabled state to `isUnchanged` property -->
<button [disabled]="isUnchanged">Save</button>
<button type="button" [disabled]="isUnchanged">Save</button>
<!-- #enddocregion disabled-button -->
</div>
@@ -20,11 +20,11 @@
<label>HTML Attribute Initializes to "Sarah":
<input type="text" value="Sarah" #bindingInput></label>
<div>
<button (click)="getHTMLAttributeValue()">Get HTML attribute value</button> Won't change.
<button type="button" (click)="getHTMLAttributeValue()">Get HTML attribute value</button> Won't change.
</div>
<div>
<button (click)="getDOMPropertyValue()">Get DOM property value</button> Changeable. Angular works with these.
<button type="button" (click)="getDOMPropertyValue()">Get DOM property value</button> Changeable. Angular works with these.
</div>
<p>2. Change the name in the input and click the buttons again.</p>
@@ -36,10 +36,10 @@
<h3>Disabled property vs. attribute</h3>
<p>Use the inspector to see the Test Button work and its disabled property toggle.</p>
<div>
<button id="testButton" (click)="working()">Test Button</button>
<button type="button" id="testButton" (click)="working()">Test Button</button>
</div>
<div>
<button (click)="toggleDisabled()">Toggle disabled property for Test Button</button>
<button type="button" (click)="toggleDisabled()">Toggle disabled property for Test Button</button>
</div>
</div>
@@ -50,7 +50,7 @@
<label for="special">special: <input type="checkbox" [(ngModel)]="isSpecial" id="special"></label>
</li>
</ul>
<button (click)="setCurrentClasses()">Refresh currentClasses</button>
<button type="button" (click)="setCurrentClasses()">Refresh currentClasses</button>
<div [ngClass]="currentClasses">
This div should be {{ canSave ? "": "not"}} saveable,
@@ -86,7 +86,7 @@
<label>italic: <input type="checkbox" [(ngModel)]="canSave"></label> |
<label>normal: <input type="checkbox" [(ngModel)]="isUnchanged"></label> |
<label>xlarge: <input type="checkbox" [(ngModel)]="isSpecial"></label>
<button (click)="setCurrentStyles()">Refresh currentStyles</button>
<button type="button" (click)="setCurrentStyles()">Refresh currentStyles</button>
<br><br>
<div [ngStyle]="currentStyles">
This div should be {{ canSave ? "italic": "plain"}},
@@ -102,7 +102,7 @@
<app-item-detail *ngIf="isActive" [item]="item"></app-item-detail>
<!-- #enddocregion NgIf-1 -->
<button (click)="isActiveToggle()">Toggle app-item-detail</button>
<button type="button" (click)="isActiveToggle()">Toggle app-item-detail</button>
</div>
<p>If currentCustomer isn't null, say hello to Laura:</p>
<!-- #docregion NgIf-2 -->
@@ -112,7 +112,7 @@
<!-- #docregion NgIf-2b -->
<div *ngIf="nullCustomer">Hello, <span>{{nullCustomer}}</span></div>
<!-- #enddocregion NgIf-2b -->
<button (click)="giveNullCustomerValue()">Give nullCustomer a value</button>
<button type="button" (click)="giveNullCustomerValue()">Give nullCustomer a value</button>
<h4>NgIf binding with template (no *)</h4>
@@ -163,9 +163,9 @@
</div>
<h4 id="ngFor-trackBy">*ngFor trackBy</h4>
<button (click)="resetList()">Reset items</button>
<button (click)="changeIds()">Change ids</button>
<button (click)="clearTrackByCounts()">Clear counts</button>
<button type="button" (click)="resetList()">Reset items</button>
<button type="button" (click)="changeIds()">Change ids</button>
<button type="button" (click)="clearTrackByCounts()">Clear counts</button>
<p><i>without</i> trackBy</p>
<div class="box">
@@ -10,6 +10,7 @@ import { Subscription } from 'rxjs';
<p>
{{astronaut}}: <strong>{{mission}}</strong>
<button
type="button"
(click)="confirm()"
[disabled]="!announced || confirmed">
Confirm
@@ -14,8 +14,8 @@ import { CountdownTimerComponent } from './countdown-timer.component';
selector: 'app-countdown-parent-lv',
template: `
<h3>Countdown to Liftoff (via local variable)</h3>
<button (click)="timer.start()">Start</button>
<button (click)="timer.stop()">Stop</button>
<button type="button" (click)="timer.start()">Start</button>
<button type="button" (click)="timer.stop()">Stop</button>
<div class="seconds">{{timer.seconds}}</div>
<app-countdown-timer #timer></app-countdown-timer>
`,
@@ -30,8 +30,8 @@ export class CountdownLocalVarParentComponent { }
selector: 'app-countdown-parent-vc',
template: `
<h3>Countdown to Liftoff (via ViewChild)</h3>
<button (click)="start()">Start</button>
<button (click)="stop()">Stop</button>
<button type="button" (click)="start()">Start</button>
<button type="button" (click)="stop()">Stop</button>
<div class="seconds">{{ seconds() }}</div>
<app-countdown-timer></app-countdown-timer>
`,
@@ -7,7 +7,7 @@ import { MissionService } from './mission.service';
selector: 'app-mission-control',
template: `
<h2>Mission Control</h2>
<button (click)="announce()">Announce mission</button>
<button type="button" (click)="announce()">Announce mission</button>
<app-astronaut
*ngFor="let astronaut of astronauts"
@@ -5,8 +5,8 @@ import { Component } from '@angular/core';
selector: 'app-version-parent',
template: `
<h2>Source code version</h2>
<button (click)="newMinor()">New minor version</button>
<button (click)="newMajor()">New major version</button>
<button type="button" (click)="newMinor()">New minor version</button>
<button type="button" (click)="newMajor()">New major version</button>
<app-version-child [major]="major" [minor]="minor"></app-version-child>
`
})
@@ -5,8 +5,8 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
selector: 'app-voter',
template: `
<h4>{{name}}</h4>
<button (click)="vote(true)" [disabled]="didVote">Agree</button>
<button (click)="vote(false)" [disabled]="didVote">Disagree</button>
<button type="button" (click)="vote(true)" [disabled]="didVote">Agree</button>
<button type="button" (click)="vote(false)" [disabled]="didVote">Disagree</button>
`
})
export class VoterComponent {
@@ -12,7 +12,7 @@ import { Hero } from './hero';
}
</style>
<h3>Controls</h3>
<button (click)="activate()">Activate</button>
<button type="button" (click)="activate()">Activate</button>
`
})
// #enddocregion inlinestyles
@@ -10,7 +10,7 @@
<body>
<h1 style="visibility: hidden;">External H1 Title for E2E test</h1>
<app-root></app-root>
<button style="visibility: hidden;">External button for E2E test</button>
<button type="button" style="visibility: hidden;">External button for E2E test</button>
<ul style="visibility: hidden;">
<li>External list for E2E test</li>
</ul>
@@ -22,7 +22,7 @@
<h2>Here's a zippy</h2>
<app-example-zippy>
<button appExampleZippyToggle>Is content project cool?</button>
<button type="button" appExampleZippyToggle>Is content project cool?</button>
<!-- #docregion ng-template-->
<ng-template appExampleZippyContent>
It depends on what you do with it.
@@ -8,10 +8,10 @@ import { BROWSER_STORAGE, BrowserStorageService } from './storage.service';
Open the inspector to see the local/session storage keys:
<h3>Session Storage</h3>
<button (click)="setSession()">Set Session Storage</button>
<button type="button" (click)="setSession()">Set Session Storage</button>
<h3>Local Storage</h3>
<button (click)="setLocal()">Set Local Storage</button>
<button type="button" (click)="setLocal()">Set Local Storage</button>
`,
providers: [
BrowserStorageService,
@@ -13,7 +13,7 @@ import { UserService } from './user.service';
<h2>User</h2>
<p id="user">
{{userInfo}}
<button (click)="nextUser()">Next User</button>
<button type="button" (click)="nextUser()">Next User</button>
<p>
<app-heroes id="authorized" *ngIf="isAuthorized"></app-heroes>
<app-heroes id="unauthorized" *ngIf="!isAuthorized"></app-heroes>
@@ -7,45 +7,68 @@
}
/* #enddocregion heroes */
.heroes {
margin: 0 0 2em 0;
list-style-type: none;
padding: 0;
width: 15em;
}
.heroes li {
display: flex;
}
.heroes button {
flex: 1;
cursor: pointer;
position: relative;
left: 0;
background-color: #EEE;
margin: .5em;
padding: .3em 0;
padding: 0;
height: 1.6em;
border-radius: 4px;
display: flex;
align-items: stretch;
height: 1.8em;
}
.heroes li.selected:hover {
background-color: #BBD8DC !important;
color: white;
}
.heroes li:hover {
color: #607D8B;
background-color: #DDD;
.heroes button:hover {
color: #2c3a41;
background-color: #e6e6e6;
left: .1em;
}
.heroes .text {
position: relative;
top: -3px;
.heroes button:active {
background-color: #525252;
color: #fafafa;
}
.heroes button.selected {
background-color: black;
color: white;
}
.heroes button.selected:hover {
background-color: #505050;
color: white;
}
.heroes button.selected:active {
background-color: black;
color: white;
}
.heroes .badge {
display: inline-block;
font-size: small;
color: white;
padding: 0.8em 0.7em 0 0.7em;
background-color: #607D8B;
background-color: #405061;
line-height: 1em;
position: relative;
left: -1px;
top: -4px;
height: 1.8em;
margin-right: .8em;
border-radius: 4px 0 0 4px;
}
.selected {
background-color: #CFD8DC !important;
color: white;
.heroes .name {
align-self: center;
}
@@ -1,17 +1,19 @@
<h1>{{title}}</h1>
<h2>My Heroes</h2>
<ul class="heroes">
<li *ngFor="let hero of heroes"
[class.selected]="hero === selectedHero"
(click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span> {{hero.name}}
<li *ngFor="let hero of heroes">
<button [class.selected]="hero === selectedHero" type="button" (click)="onSelect(hero)">
<span class="badge">{{hero.id}}</span>
<span class="name">{{hero.name}}</span>
</button>
</li>
</ul>
<div *ngIf="selectedHero">
<h2>{{selectedHero.name}} details!</h2>
<div><label>id: </label>{{selectedHero.id}}</div>
<div>id: {{selectedHero.id}}</div>
<div>
<label>name: </label>
<input [(ngModel)]="selectedHero.name" placeholder="name"/>
<label>
name: <input [(ngModel)]="selectedHero.name" placeholder="name"/>
</label>
</div>
</div>
@@ -7,8 +7,8 @@ import { PopupComponent } from './popup.component';
selector: 'app-root',
template: `
<input #input value="Message">
<button (click)="popup.showAsComponent(input.value)">Show as component</button>
<button (click)="popup.showAsElement(input.value)">Show as element</button>
<button type="button" (click)="popup.showAsComponent(input.value)">Show as component</button>
<button type="button" (click)="popup.showAsElement(input.value)">Show as element</button>
`,
})
export class AppComponent {
@@ -6,7 +6,7 @@ import { animate, state, style, transition, trigger } from '@angular/animations'
selector: 'my-popup',
template: `
<span>Popup: {{message}}</span>
<button (click)="closed.next()">&#x2716;</button>
<button type="button" (click)="closed.next()">&#x2716;</button>
`,
animations: [
trigger('state', [
@@ -2,13 +2,13 @@
<div class="group">
<h3>Target event</h3>
<button (click)="onSave($event)">Save</button>
<button type="button" (click)="onSave($event)">Save</button>
<button on-click="onSave($event)">on-click Save</button>
<button type="button" on-enter="onSave()">on-click Save</button>
<!-- #docregion custom-directive -->
<h4>myClick is an event on the custom ClickDirective:</h4>
<button (myClick)="clickMessage=$event" clickable>click with myClick</button>
<button type="button" (myClick)="clickMessage=$event" clickable>click with myClick</button>
{{clickMessage}}
<!-- #enddocregion custom-directive -->
@@ -34,16 +34,21 @@
<h4>Click to see event target class:</h4>
<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->
<div class="parent-div" (click)="onClickMe($event)" clickable>Click me (parent)
<div class="child-div">Click me too! (child) </div>
</div>
<h3>Saves only once:</h3>
<div (click)="onSave()" clickable>
<button (click)="onSave($event)">Save, no propagation</button>
<button type="button" (click)="onSave($event)">Save, no propagation</button>
</div>
<h3>Saves twice:</h3>
<div (click)="onSave()" clickable>
<button (click)="onSave()">Save with propagation</button>
<button type="button" (click)="onSave()">Save with propagation</button>
</div>
<!-- eslint-enable @angular-eslint/template/click-events-have-key-events -->
@@ -1,9 +1,9 @@
<div class="detail">
<p>This is the ItemDetailComponent</p>
<!-- #docregion line-through -->
<img src="{{itemImageUrl}}" [style.display]="displayNone">
<img src="{{itemImageUrl}}" alt="{{item.name}}" [style.display]="displayNone">
<span [style.text-decoration]="lineThrough">{{ item.name }}
</span>
<button (click)="delete()">Delete</button>
<button type="button" (click)="delete()">Delete</button>
<!-- #enddocregion line-through -->
</div>
@@ -19,16 +19,21 @@ export class HeroFormReactiveComponent implements OnInit {
heroForm: FormGroup;
ngOnInit(): void {
// #docregion async-validator-usage
const alterEgoControl = new FormControl('', {
asyncValidators: [this.alterEgoValidator.validate.bind(this.alterEgoValidator)],
updateOn: 'blur'
});
// #enddocregion async-validator-usage
alterEgoControl.setValue(this.hero.alterEgo);
this.heroForm = new FormGroup({
name: new FormControl(this.hero.name, [
Validators.required,
Validators.minLength(4),
forbiddenNameValidator(/bob/i)
]),
alterEgo: new FormControl(this.hero.alterEgo, {
asyncValidators: [this.alterEgoValidator.validate.bind(this.alterEgoValidator)],
updateOn: 'blur'
}),
alterEgo: alterEgoControl,
power: new FormControl(this.hero.power, Validators.required)
});
}
@@ -39,5 +44,7 @@ export class HeroFormReactiveComponent implements OnInit {
get alterEgo() { return this.heroForm.get('alterEgo'); }
// #docregion async-validator-inject
constructor(private alterEgoValidator: UniqueAlterEgoValidator) {}
// #enddocregion async-validator-inject
}
@@ -74,6 +74,6 @@
<div class="submitted-message" *ngIf="formDir.submitted">
<p>You've submitted your hero, {{ heroForm.value.name }}!</p>
<button (click)="formDir.resetForm({})">Add new hero</button>
<button type="button" (click)="formDir.resetForm({})">Add new hero</button>
</div>
</div>
@@ -15,9 +15,9 @@ export class UniqueAlterEgoValidator implements AsyncValidator {
constructor(private heroesService: HeroesService) {}
validate(
ctrl: AbstractControl
): Promise<ValidationErrors | null> | Observable<ValidationErrors | null> {
return this.heroesService.isAlterEgoTaken(ctrl.value).pipe(
control: AbstractControl
): Observable<ValidationErrors | null> {
return this.heroesService.isAlterEgoTaken(control.value).pipe(
map(isTaken => (isTaken ? { uniqueAlterEgo: true } : null)),
catchError(() => of(null))
);
@@ -25,20 +25,24 @@ export class UniqueAlterEgoValidator implements AsyncValidator {
}
// #enddocregion async-validator
// #docregion async-validator-directive
@Directive({
selector: '[appUniqueAlterEgo]',
providers: [
{
provide: NG_ASYNC_VALIDATORS,
useExisting: forwardRef(() => UniqueAlterEgoValidator),
useExisting: forwardRef(() => UniqueAlterEgoValidatorDirective),
multi: true
}
]
})
export class UniqueAlterEgoValidatorDirective {
export class UniqueAlterEgoValidatorDirective implements AsyncValidator {
constructor(private validator: UniqueAlterEgoValidator) {}
validate(control: AbstractControl) {
this.validator.validate(control);
validate(
control: AbstractControl
): Observable<ValidationErrors | null> {
return this.validator.validate(control);
}
}
// #enddocregion async-validator-directive
@@ -35,14 +35,15 @@
<div class="form-group">
<label for="alterEgo">Alter Ego</label>
<input type="text"
<!-- #docregion alterEgo-input -->
<input type="text"
id="alterEgo"
name="alterEgo"
#alterEgo="ngModel"
[(ngModel)]="hero.alterEgo"
[ngModelOptions]="{ updateOn: 'blur' }"
appUniqueAlterEgo>
<!-- #enddocregion alterEgo-input -->
<div *ngIf="alterEgo.pending">Validating...</div>
<div *ngIf="alterEgo.invalid" class="alert alter-ego-errors">
<div *ngIf="alterEgo.errors?.['uniqueAlterEgo']">
@@ -81,7 +82,7 @@
<div class="submitted-message" *ngIf="heroForm.submitted">
<p>You've submitted your hero, {{ heroForm.value.name }}!</p>
<button (click)="heroForm.resetForm({})">Add new hero</button>
<button type="button" (click)="heroForm.resetForm({})">Add new hero</button>
</div>
</form>
</div>
@@ -83,7 +83,7 @@
<div class="col-xs-9">{{ model.power }}</div>
</div>
<br>
<button class="btn btn-primary" (click)="submitted=false">Edit</button>
<button type="button" class="btn btn-primary" (click)="submitted=false">Edit</button>
</div>
<!-- #enddocregion submitted -->
</div>
@@ -1,3 +1,3 @@
<p *ngIf="product && product.price > 700">
<button>Notify Me</button>
<button type="button">Notify Me</button>
</p>
@@ -1,3 +1,3 @@
<p *ngIf="product && product.price > 700">
<button (click)="notify.emit()">Notify Me</button>
<button type="button" (click)="notify.emit()">Notify Me</button>
</p>
@@ -7,6 +7,6 @@
<h4>{{ product.price | currency }}</h4>
<p>{{ product.description }}</p>
<!-- #enddocregion details -->
<button (click)="addToCart(product)">Buy</button>
<button type="button" (click)="addToCart(product)">Buy</button>
<!-- #docregion details -->
</div>
@@ -12,7 +12,7 @@
Description: {{ product.description }}
</p>
<button (click)="share()">
<button type="button" (click)="share()">
Share
</button>
@@ -13,7 +13,7 @@
</p>
<!-- #docregion app-product-alerts -->
<button (click)="share()">
<button type="button" (click)="share()">
Share
</button>
@@ -13,7 +13,7 @@
</p>
<!-- #docregion on-notify -->
<button (click)="share()">
<button type="button" (click)="share()">
Share
</button>
@@ -16,7 +16,7 @@
Description: {{ product.description }}
</p>
<button (click)="share()">
<button type="button" (click)="share()">
Share
</button>
@@ -10,7 +10,7 @@ describe('Hierarchical dependency injection', () => {
income: '',
// queries
heroEl: element.all(by.css('app-heroes-list li')).get(0), // first hero
heroEl: element.all(by.css('app-heroes-list li button')).get(0), // first hero
heroCardEl: element(by.css('app-heroes-list app-hero-tax-return')), // first hero tax-return
taxReturnNameEl: element.all(by.css('app-heroes-list app-hero-tax-return #name')).get(0),
incomeInputEl: element.all(by.css('app-heroes-list app-hero-tax-return input')).get(0),
@@ -2,7 +2,7 @@
<div class="msg" [class.canceled]="message==='Canceled'">{{message}}</div>
<fieldset>
<span id=name>{{taxReturn.name}}</span>
<label id=tid>TID: {{taxReturn.tid}}</label>
<span id=tid>TID: {{taxReturn.tid}}</span>
</fieldset>
<fieldset>
<label>
@@ -10,11 +10,11 @@
</label>
</fieldset>
<fieldset>
<label>Tax: {{taxReturn.tax}}</label>
<span>Tax: {{taxReturn.tax}}</span>
</fieldset>
<fieldset>
<button (click)="onSaved()">Save</button>
<button (click)="onCanceled()">Cancel</button>
<button (click)="onClose()">Close</button>
<button type="button" (click)="onSaved()">Save</button>
<button type="button" (click)="onCanceled()">Cancel</button>
<button type="button" (click)="onClose()">Close</button>
</fieldset>
</div>
@@ -11,8 +11,8 @@ import { HeroesService } from './heroes.service';
<div>
<h3>Hero Tax Returns</h3>
<ul>
<li *ngFor="let hero of heroes | async"
(click)="showTaxReturn(hero)">{{hero.name}}
<li *ngFor="let hero of heroes | async">
<button type="button" (click)="showTaxReturn(hero)">{{hero.name}}</button>
</li>
</ul>
<app-hero-tax-return
@@ -22,7 +22,13 @@ import { HeroesService } from './heroes.service';
</app-hero-tax-return>
</div>
`,
styles: [ 'li {cursor: pointer;}' ]
styles: [`
li button {
font-size: inherit;
margin: 0.3rem;
padding: 0.5rem;
}
`]
})
export class HeroesListComponent {
heroes: Observable<Hero[]>;
@@ -1,9 +1,9 @@
<h3>Get configuration from JSON file</h3>
<div>
<button (click)="clear(); showConfig()">get</button>
<button (click)="clear(); showConfigResponse()">getResponse</button>
<button (click)="clear()">clear</button>
<button (click)="clear(); makeError()">error</button>
<button type="button" (click)="clear(); showConfig()">get</button>
<button type="button" (click)="clear(); showConfigResponse()">getResponse</button>
<button type="button" (click)="clear()">clear</button>
<button type="button" (click)="clear(); makeError()">error</button>
<span *ngIf="config">
<p>Heroes API URL is "{{config.heroesUrl}}"</p>
<p>Textfile URL is "{{config.textfile}}"</p>
@@ -1,4 +1,4 @@
<h2>Download the text file</h2>
<button (click)="download()">Download</button>
<button (click)="clear()">clear</button>
<button type="button" (click)="download()">Download</button>
<button type="button" (click)="clear()">clear</button>
<p *ngIf="contents">Contents: "{{contents}}"</p>
@@ -9,21 +9,20 @@
}
.heroes li {
position: relative;
display: flex;
width: 100%;
}
.heroes li:hover {
left: .1em;
}
.heroes a {
.heroes button.delete {
color: black;
display: block;
font-size: 1.2rem;
background-color: #eee;
margin: .5em 0;
padding: .5em 0;
border-radius: 4px;
border-radius: 0 4px 4px 0;
}
.heroes a:hover {
@@ -40,8 +39,18 @@
border-radius: 4px 0 0 4px;
}
.heroes button.edit {
flex: 1;
text-align: left;
padding: 0;
margin-right: 0;
display: flex;
align-items: center;
border-top-right-radius: 0;
border-bottom-right-radius: 0;
}
button.delete {
position: absolute;
right: -8px;
top: 5px;
background-color: gray;
@@ -53,6 +62,4 @@ button.delete {
.heroes input {
max-width: 12rem;
padding: .25rem;
position: absolute;
top: 8px;
}
@@ -4,17 +4,17 @@
<input type="text" #heroName id="hero-name">
<!-- (click) passes input value to add() and then clears the input -->
<button (click)="add(heroName.value); heroName.value=''">
<button type="button" (click)="add(heroName.value); heroName.value=''">
Add hero
</button>
<button (click)="search(heroName.value)">
<button type="button" (click)="search(heroName.value)">
Search
</button>
</div>
<ul class="heroes">
<li *ngFor="let hero of heroes">
<a (click)="edit(hero)">
<button type="button" class="edit" (click)="edit(hero)">
<span class="badge">{{ hero.id || -1 }}</span>
<span *ngIf="hero!==editHero">{{hero.name}}</span>
<input type="text"
@@ -22,8 +22,8 @@
[(ngModel)]="hero.name"
(blur)="update()"
(keyup.enter)="update()">
</a>
<button class="delete" title="delete hero"
</button>
<button type="button" class="delete" title="delete hero"
(click)="delete(hero)">x</button>
</li>
</ul>
@@ -1,6 +1,6 @@
<div *ngIf="messageService.messages.length">
<h2>Messages</h2>
<button class="clear" (click)="messageService.clear()">clear</button>
<button type="button" class="clear" (click)="messageService.clear()">clear</button>
<br>
<ol>
<li *ngFor='let message of messageService.messages'> {{message}} </li>
@@ -27,11 +27,11 @@
<!--#enddocregion i18n-attribute-solo-id-->
<!--#docregion i18n-title-->
<img [src]="logo" title="Angular logo">
<img [src]="logo" title="Angular logo" alt="Angular logo">
<!--#enddocregion i18n-title-->
<!--#docregion i18n-duplicate-custom-id-->
<h3 i18n="@@myId">Hello</h3>
<!-- ... -->
<p i18n="@@myId">Good bye</p>
<!--#enddocregion i18n-duplicate-custom-id-->
<!--#enddocregion i18n-duplicate-custom-id-->
@@ -10,16 +10,16 @@
<br />
<!--#docregion i18n-title-translate-->
<img [src]="logo" i18n-title title="Angular logo" />
<img [src]="logo" i18n-title title="Angular logo" alt="Angular logo"/>
<!--#enddocregion i18n-title-translate-->
<br>
<button (click)="inc(1)">+</button> <button (click)="inc(-1)">-</button>
<button type="button" (click)="inc(1)">+</button> <button type="button" (click)="inc(-1)">-</button>
<!--#docregion i18n-plural-->
<span i18n>Updated {minutes, plural, =0 {just now} =1 {one minute ago} other {{{minutes}} minutes ago}}</span>
<!--#enddocregion i18n-plural-->
({{minutes}})
<br><br>
<button (click)="male()">&#9794;</button> <button (click)="female()">&#9792;</button> <button (click)="other()">&#9895;</button>
<button type="button" (click)="male()">&#9794;</button> <button type="button" (click)="female()">&#9792;</button> <button type="button" (click)="other()">&#9895;</button>
<!--#docregion i18n-select-->
<span i18n>The author is {gender, select, male {male} female {female} other {other}}</span>
<!--#enddocregion i18n-select-->
@@ -1,6 +1,6 @@
<p>Save for later item: {{input1}}</p>
<button (click)="saveIt()"> Save for later</button>
<button type="button" (click)="saveIt()"> Save for later</button>
<p>Item for wishlist: {{input2}}</p>
<button (click)="wishForIt()"> Add to wishlist</button>
<button type="button" (click)="wishForIt()"> Add to wishlist</button>
@@ -1,3 +1,3 @@
<p>Latest clearance item: {{clearanceItem}}</p>
<button (click)="buyIt()"> Buy it with an Output!</button>
<button type="button" (click)="buyIt()"> Buy it with an Output!</button>
@@ -1,2 +1,2 @@
<p [style.text-decoration]="lineThrough">Item: {{item}}</p>
<button (click)="delete()">Delete item with an Output!</button>
<button type="button" (click)="delete()">Delete item with an Output!</button>
@@ -3,5 +3,5 @@
<!-- #docregion child-output -->
<label for="item-input">Add an item:</label>
<input type="text" id="item-input" #newItem>
<button (click)="addNewItem(newItem.value)">Add to parent's list</button>
<button type="button" (click)="addNewItem(newItem.value)">Add to parent's list</button>
<!-- #enddocregion child-output -->
@@ -11,7 +11,7 @@
<!-- #docregion component-property -->
<p>{{title}}</p>
<div><img src="{{itemImageUrl}}"></div>
<div><img alt="item" src="{{itemImageUrl}}"></div>
<!-- #enddocregion component-property -->
<h3>Evaluating template expressions </h3>
@@ -35,7 +35,7 @@
<h3>Component context, properties of app.component.ts:</h3>
<!-- #docregion component-context -->
<h4>{{recommended}}</h4>
<img [src]="itemImageUrl2">
<img alt="item 2" [src]="itemImageUrl2">
<!-- #enddocregion component-context -->
</div>
@@ -4,9 +4,9 @@
{{title}}
</h1>
<button routerLink="/customers">Customers</button>
<button routerLink="/orders">Orders</button>
<button routerLink="">Home</button>
<button type="button" routerLink="/customers">Customers</button>
<button type="button" routerLink="/orders">Orders</button>
<button type="button" routerLink="">Home</button>
<router-outlet></router-outlet>
@@ -18,7 +18,7 @@ import { LoggerService } from './logger.service';
<div class="info">
<h3>AfterContent Logs</h3>
<button (click)="reset()">Reset</button>
<button type="button" (click)="reset()">Reset</button>
<div *ngFor="let msg of logger.logs" class="log">{{msg}}</div>
</div>
</div>
@@ -11,7 +11,7 @@ import { LoggerService } from './logger.service';
<div class="info">
<h3>AfterView Logs</h3>
<button (click)="reset()">Reset</button>
<button type="button" (click)="reset()">Reset</button>
<div *ngFor="let msg of logger.logs" class="log">{{msg}}</div>
</div>
`,
@@ -1,5 +1,4 @@
<a id="top"></a>
<h1>Lifecycle Hooks</h1>
<h1 id="top">Lifecycle Hooks</h1>
<a href="#hooks">Peek-a-boo: (most) lifecycle hooks</a>
<a href="#spy">Spy: directive with OnInit & OnDestroy</a>
<a href="#onchanges">OnChanges</a>
@@ -8,36 +7,29 @@
<a href="#after-content">AfterContentInit & AfterContentChecked</a>
<a href="#counter">Counter: OnChanges + Spy directive</a>
<a id="hooks"></a>
<peek-a-boo-parent></peek-a-boo-parent>
<peek-a-boo-parent id="hooks"></peek-a-boo-parent>
<a href="#top">back to top</a>
<hr />
<a id="spy"></a>
<spy-parent></spy-parent>
<spy-parent id="spy"></spy-parent>
<a href="#top">back to top</a>
<hr />
<a id="onchanges"></a>
<on-changes-parent></on-changes-parent>
<on-changes-parent id="onchanges"></on-changes-parent>
<a href="#top">back to top</a>
<hr />
<a id="docheck"></a>
<do-check-parent></do-check-parent>
<do-check-parent id="docheck"></do-check-parent>
<a href="#top">back to top</a>
<hr />
<a id="after-view"></a>
<after-view-parent></after-view-parent>
<after-view-parent id="after-view"></after-view-parent>
<a href="#top">back to top</a>
<hr />
<a id="after-content"></a>
<after-content-parent></after-content-parent>
<after-content-parent id="after-content"></after-content-parent>
<a href="#top">back to top</a>
<hr />
<a id="counter"></a>
<counter-parent></counter-parent>
<counter-parent id="counter"></counter-parent>
<a href="#top">back to top</a>
@@ -7,8 +7,8 @@ import { LoggerService } from './logger.service';
template: `
<h2>Counter Spy</h2>
<button (click)="updateCounter()">Update counter</button>
<button (click)="reset()">Reset Counter</button>
<button type="button" (click)="updateCounter()">Update counter</button>
<button type="button" (click)="reset()">Reset Counter</button>
<app-counter [counter]="value"></app-counter>
@@ -1,9 +1,9 @@
<h2>{{title}}</h2>
<label for="power-input"><label>Power: </label>
<label for="power-input">Power: </label>
<input type="text" id="power-input" [(ngModel)]="power">
<label for="hero-name">Hero.name: </label>
<input type="text" id="hero-name" [(ngModel)]="hero.name">
<button (click)="reset()">Reset Log</button>
<button type="button" (click)="reset()">Reset Log</button>
<do-check [hero]="hero" [power]="power"></do-check>
@@ -4,7 +4,7 @@
<label for="hero-name"> Hero.name: </label>
<input type="text" id="hero-name" [(ngModel)]="hero.name">
<button (click)="reset()">Reset Log</button>
<button type="button" (click)="reset()">Reset Log</button>
<!-- #docregion on-changes -->
<on-changes [hero]="hero" [power]="power"></on-changes>
@@ -10,10 +10,10 @@ import { LoggerService } from './logger.service';
<div class="parent">
<h2>Peek-A-Boo</h2>
<button (click)="toggleChild()">
<button type="button" (click)="toggleChild()">
{{hasChild ? 'Destroy' : 'Create'}} PeekABooComponent
</button>
<button (click)="updateHero()" [hidden]="!hasChild">Update Hero</button>
<button type="button" (click)="updateHero()" [hidden]="!hasChild">Update Hero</button>
<div class="info">
<peek-a-boo *ngIf="hasChild" [name]="heroName"></peek-a-boo>
@@ -3,8 +3,8 @@
<label for="hero-name">Hero name: </label>
<input type="text" id="hero-name" [(ngModel)]="newName" (keyup.enter)="addHero()">
<button (click)="addHero()">Add Hero</button>
<button (click)="reset()">Reset Heroes</button>
<button type="button" (click)="addHero()">Add Hero</button>
<button type="button" (click)="reset()">Reset Heroes</button>
<div class="info">
<!-- #docregion template -->
@@ -9,7 +9,7 @@
<h3>&lt;ng-container&gt; and CSS</h3>
<p>Examples demonstrating issues with rigid CSS styles.</p>
<button (click)="hero = hero ? null : heroes[0]">Toggle hero</button>
<button type="button" (click)="hero = hero ? null : heroes[0]">Toggle hero</button>
<h4>#1 &lt;ng-container&gt; and &lt;p&gt;</h4>
<p>
@@ -11,7 +11,7 @@ import { Observable } from 'rxjs';
selector: 'app-zippy',
template: `
<div class="zippy">
<div (click)="toggle()">Toggle</div>
<button type="button" (click)="toggle()">Toggle</button>
<div [hidden]="!visible">
<ng-content></ng-content>
</div>
@@ -1,5 +1,4 @@
<a id="toc"></a>
<h1>Pipes</h1>
<h1 id="toc">Pipes</h1>
<a href="#happy-birthday1">Happy Birthday v1</a>
<a href="#birthday-date-pipe">Birthday DatePipe</a>
<a href="#happy-birthday2">Happy Birthday v2</a>
@@ -14,13 +13,11 @@
<hr>
<a id="happy-birthday1"></a>
<h2>Hero Birthday v1</h2>
<h2 id="happy-birthday1">Hero Birthday v1</h2>
<app-hero-birthday></app-hero-birthday>
<hr>
<a id="birthday-date-pipe"></a>
<h2>Birthday DatePipe</h2>
<h2 id="birthday-date-pipe">Birthday DatePipe</h2>
<!-- #docregion hero-birthday-template -->
<p>The hero's birthday is {{ birthday | date }}</p>
<!-- #enddocregion hero-birthday-template-->
@@ -30,13 +27,11 @@
<!-- #enddocregion format-birthday-->
<hr>
<a id="happy-birthday2"></a>
<h2>Hero Birthday v2</h2>
<h2 id="happy-birthday2">Hero Birthday v2</h2>
<app-hero-birthday2></app-hero-birthday2>
<hr>
<a id="birthday-pipe-chaining"></a>
<h2>Birthday Pipe Chaining</h2>
<h2 id="birthday-pipe-chaining">Birthday Pipe Chaining</h2>
<p>
<!-- #docregion chained-birthday -->
The chained hero's birthday is
@@ -55,31 +50,24 @@
{{ ( birthday | date:'fullDate' ) | uppercase}}
</p>
<hr>
<a id="power-booster"></a>
<app-power-booster></app-power-booster>
<app-power-booster id="power-booster"></app-power-booster>
<hr>
<a id="power-boost-calc"></a>
<app-power-boost-calculator>loading</app-power-boost-calculator>
<app-power-boost-calculator id="power-boost-calc">loading</app-power-boost-calculator>
<hr>
<a id="flying-heroes"></a>
<app-flying-heroes></app-flying-heroes>
<app-flying-heroes id="flying-heroes"></app-flying-heroes>
<hr>
<a id="flying-heroes-impure"></a>
<app-flying-heroes-impure></app-flying-heroes-impure>
<app-flying-heroes-impure id="flying-heroes-impure"></app-flying-heroes-impure>
<hr>
<a id="hero-message"></a>
<!-- async examples at the top so can see them in action -->
<app-hero-async-message></app-hero-async-message>
<app-hero-async-message id="hero-message"></app-hero-async-message>
<hr>
<a id="hero-list"></a>
<app-hero-list></app-hero-list>
<app-hero-list id="hero-list"></app-hero-list>
<hr>
<a id="pipe-precedence"></a>
<app-precedence></app-precedence>
<app-precedence id="pipe-precedence"></app-precedence>
<hr>
@@ -15,7 +15,7 @@
<div>
<input id="mutate" type="checkbox" [(ngModel)]="mutate">Mutate array
<button (click)="reset()">Reset</button>
<button type="button" (click)="reset()">Reset</button>
</div>
<h3>Heroes who fly (piped)</h3>
@@ -17,7 +17,7 @@
<input id="mutate" type="checkbox" [(ngModel)]="mutate">
<label for="mutate">Mutate array</label>
<!-- #docregion template-1 -->
<button (click)="reset()">Reset list of heroes</button>
<button type="button" (click)="reset()">Reset list of heroes</button>
<!-- #enddocregion template-1 -->
</div>
@@ -9,7 +9,7 @@ import { map, take } from 'rxjs/operators';
template: `
<h2>Async Hero Message and AsyncPipe</h2>
<p>Message: {{ message$ | async }}</p>
<button (click)="resend()">Resend</button>`,
<button type="button" (click)="resend()">Resend</button>`,
})
export class HeroAsyncMessageComponent {
message$: Observable<string>;
@@ -6,7 +6,7 @@ import { Component } from '@angular/core';
// #docregion template
template: `
<p>The hero's birthday is {{ birthday | date:format }}</p>
<button (click)="toggleFormat()">Toggle Format</button>
<button type="button" (click)="toggleFormat()">Toggle Format</button>
`
// #enddocregion template
})
@@ -4,7 +4,7 @@
<h1>Property Binding with Angular</h1>
<h2>Binding the src property of an image:</h2>
<!-- #docregion property-binding -->
<img [src]="itemImageUrl">
<img alt="item" [src]="itemImageUrl">
<!-- #enddocregion property-binding -->
<hr />
@@ -20,7 +20,7 @@
<h2>Button disabled state bound to isUnchanged property:</h2>
<!-- #docregion disabled-button -->
<!-- Bind button disabled state to `isUnchanged` property -->
<button [disabled]="isUnchanged">Disabled Button</button>
<button type="button" [disabled]="isUnchanged">Disabled Button</button>
<!-- #enddocregion disabled-button -->
<hr />
@@ -47,8 +47,8 @@
<h2>Property binding and interpolation</h2>
<!-- #docregion property-binding-interpolation -->
<p><img src="{{itemImageUrl}}"> is the <i>interpolated</i> image.</p>
<p><img [src]="itemImageUrl"> is the <i>property bound</i> image.</p>
<p><img alt="Interpolated item" src="{{itemImageUrl}}"> is the <i>interpolated</i> image.</p>
<p><img alt="Property Bound item" [src]="itemImageUrl"> is the <i>property bound</i> image.</p>
<p><span>"{{interpolationTitle}}" is the <i>interpolated</i> title.</span></p>
<p>"<span [innerHTML]="propertyTitle"></span>" is the <i>property bound</i> title.</p>
@@ -3,8 +3,8 @@ import { browser, element, by } from 'protractor';
describe('Reactive forms', () => {
const nameEditor = element(by.css('app-name-editor'));
const profileEditor = element(by.css('app-profile-editor'));
const nameEditorLink = element(by.cssContainingText('app-root > nav > a', 'Name Editor'));
const profileEditorLink = element(by.cssContainingText('app-root > nav > a', 'Profile Editor'));
const nameEditorButton = element(by.cssContainingText('app-root > nav > button', 'Name Editor'));
const profileEditorButton = element(by.cssContainingText('app-root > nav > button', 'Profile Editor'));
beforeAll(() => browser.get(''));
@@ -14,7 +14,7 @@ describe('Reactive forms', () => {
const nameText = 'John Smith';
beforeAll(async () => {
await nameEditorLink.click();
await nameEditorButton.click();
});
beforeEach(async () => {
@@ -66,12 +66,12 @@ describe('Reactive forms', () => {
};
beforeAll(async () => {
await profileEditorLink.click();
await profileEditorButton.click();
});
beforeEach(async () => {
await browser.get('');
await profileEditorLink.click();
await profileEditorButton.click();
});
it('should be invalid by default', async () => {
@@ -1,3 +1,4 @@
nav a {
nav button {
padding: 1rem;
font-size: inherit;
}

Some files were not shown because too many files have changed in this diff Show More