Compare commits
299 Commits
10.1.3
...
11.0.0-nex
Author | SHA1 | Date | |
---|---|---|---|
6ae1f198e6 | |||
1a0e7cca2d | |||
c8d757624b | |||
31e42f0947 | |||
ddc9e8e47a | |||
1e3f810f8f | |||
e8084ff906 | |||
827245fdb6 | |||
8b7acc4f8f | |||
393ce5574b | |||
2aeaedc519 | |||
8f66540152 | |||
8f11b516f8 | |||
c8958d76db | |||
f6052a915d | |||
37ed4bd9ff | |||
efe0e03fe1 | |||
ded9aeb447 | |||
b16a69c7a4 | |||
a6971ba89a | |||
93c3d8f9fd | |||
1b70dc931d | |||
3ba97ab391 | |||
e2997ed5ee | |||
bf010b9a07 | |||
387fd89b3f | |||
e991fee6bf | |||
06525cfed3 | |||
e9a8f9f705 | |||
3f9be429fc | |||
4fd635a03a | |||
53a7ed4317 | |||
2df39ee338 | |||
2b6b9c95f9 | |||
c5e178997c | |||
cb7164a236 | |||
4a9f4520ce | |||
914d7099ee | |||
e459dc7c42 | |||
fd7146cc71 | |||
5ef2c983b9 | |||
c74917a7d5 | |||
494a2f3be4 | |||
fc3b3fe39e | |||
5448e84cf0 | |||
7bd18fca19 | |||
5a86fb33ba | |||
5db84d7221 | |||
eb32b6bd6b | |||
b2579d43cd | |||
9fb541787c | |||
812615bb99 | |||
2ede800f0c | |||
f96dcc5ce0 | |||
372a6cf8d7 | |||
b9dce19b3d | |||
964ac1542a | |||
8b01d42e5d | |||
474ecf6d00 | |||
caa7f9808f | |||
69bb49e530 | |||
9dccaa9570 | |||
e1c11a36c7 | |||
c1b47bcfaa | |||
d7ff8d765c | |||
3a598cf5ed | |||
b041c118e3 | |||
6af638d58e | |||
9e0e763156 | |||
758d0e2045 | |||
4744c229db | |||
4dfe0fa068 | |||
3b919ef10f | |||
7b2aac97df | |||
daf8b7f100 | |||
5f815c0565 | |||
c7d5555dfb | |||
323be39297 | |||
0dd859757a | |||
239968d2f1 | |||
cf9176eb46 | |||
2f6777df18 | |||
4ca1c736bb | |||
f2c00aab8d | |||
9aff09b827 | |||
e790c8547e | |||
b627f7f02e | |||
7f6f8bbffb | |||
e4f4d18e7e | |||
837889f0a4 | |||
bd7d8744fa | |||
4c8766573d | |||
8422633b8a | |||
37297cfed7 | |||
19d543f71e | |||
f979914d4e | |||
40975e06c6 | |||
ffe89fb07d | |||
15ea811f05 | |||
4baabf9cd3 | |||
7244e1b4e3 | |||
b1682526dd | |||
75610505c6 | |||
ba3f4c26bb | |||
c8f056beb6 | |||
a2068523fd | |||
145ab3d7e0 | |||
3082f7378b | |||
297b123151 | |||
a93605f2a4 | |||
15dfd3439a | |||
123bff7cb6 | |||
6158dc16b4 | |||
b0a43872a8 | |||
856e74ac98 | |||
6ae3b68acf | |||
49f27e31ed | |||
1a62f74496 | |||
2b1b7180db | |||
fdd4fa0009 | |||
984ed39195 | |||
0c0c54d615 | |||
dfbfabc052 | |||
f3f6a42342 | |||
e498ea9b5a | |||
a91f0f6b82 | |||
d5ddb9f340 | |||
b68fab547a | |||
16a560119a | |||
88d7bb8386 | |||
2d6105a784 | |||
95b8a8706a | |||
d92a0dd72f | |||
55485713a3 | |||
d3169c533e | |||
e4424863c2 | |||
d795a00137 | |||
7fb388f929 | |||
02c6bff9cf | |||
ef28e15884 | |||
a33d630a21 | |||
c4b8964424 | |||
dd8d8c8289 | |||
129107191c | |||
722699fb0c | |||
5614258cc7 | |||
e62a918542 | |||
49ee90b1b5 | |||
7849fdde09 | |||
97adc27207 | |||
41bc2701c4 | |||
a765530277 | |||
5b33798796 | |||
44074499dc | |||
ba54671993 | |||
a85109fd72 | |||
85a2626620 | |||
d192c87f6a | |||
3817e5f1df | |||
171a0d0696 | |||
a1c1c450dc | |||
fd44d84a33 | |||
f0688b4d18 | |||
b9ca6d20cc | |||
e00535a2a4 | |||
593bd594e3 | |||
284c70ee9d | |||
78e1ecb161 | |||
3934f0a833 | |||
297c060ae7 | |||
077f51685a | |||
e162da0753 | |||
354138eba9 | |||
6768fe9927 | |||
57c442f930 | |||
f667e374a9 | |||
15207e3c9c | |||
66129f8ea6 | |||
da14b72550 | |||
27cc56b359 | |||
6acea54f62 | |||
2d52c80332 | |||
03447ba52f | |||
8f349b2375 | |||
19598b47ca | |||
f56ece4fdc | |||
cf2e8b99a8 | |||
c4556db9f5 | |||
a46e0e48a3 | |||
9e77bd3087 | |||
26f28200bf | |||
ce1efc1af2 | |||
d1415162cb | |||
db21c4fb44 | |||
281865bbcf | |||
3406ec15a4 | |||
85951a0465 | |||
0ae00bb1f7 | |||
1373a98e25 | |||
1ed6913b8b | |||
3c4b8b97c1 | |||
f9421184ef | |||
c6ebb77cec | |||
a69507a0ad | |||
886f58d4fe | |||
18f84a0328 | |||
b0ca3cd0c4 | |||
3d77b64fc3 | |||
f645d26e3f | |||
6d9bfb8368 | |||
7997fc5f97 | |||
3cb2a79399 | |||
d896c33b0e | |||
19a484302d | |||
ded075a79c | |||
ba95b79a21 | |||
4faac78e32 | |||
4360eed9b7 | |||
c880e393e9 | |||
b0c79f2373 | |||
a32a317ea1 | |||
bfb7eec698 | |||
7e0b3fd953 | |||
7a6a061a9e | |||
109555b33a | |||
bf31ef29f6 | |||
40096bee00 | |||
45a73dddfd | |||
687477279b | |||
4007422cc6 | |||
1150649139 | |||
7869de6136 | |||
2c4a98a285 | |||
92ff6d93eb | |||
83ace4ed30 | |||
926ffcd8ac | |||
97475d7408 | |||
a29f9a9fb3 | |||
9f28f82598 | |||
261f689e9b | |||
1d9873c44c | |||
d9da7e5a18 | |||
79d8795633 | |||
3e57ca1d98 | |||
c2d017de83 | |||
7baa7ebfc4 | |||
4e5286180b | |||
73001b42fe | |||
c90eb5450d | |||
3e97435f1c | |||
1c7e5cef3e | |||
2cb3d58b42 | |||
44bb85ade4 | |||
50f4d8a1ce | |||
fdea1804d6 | |||
1d8c5d88cd | |||
a68f1a78a7 | |||
86e11f1110 | |||
5da1934115 | |||
86e7cd8117 | |||
e6ee7c2aeb | |||
54687f7765 | |||
59c234cfb4 | |||
a6f3cd93a9 | |||
d9fea857db | |||
03dbcc7a56 | |||
c142b071eb | |||
71acf9dd49 | |||
f5a148b1b7 | |||
4f28192d62 | |||
0fc2bef0cd | |||
f5d1e9a2d1 | |||
036a2faf02 | |||
5be4edfa17 | |||
38d6596742 | |||
0a7a5e3aff | |||
d5fabc303d | |||
ebc0e46501 | |||
3487b549fd | |||
52c7a4bfc6 | |||
827ba05914 | |||
b2857b4e3a | |||
5d5caf21b8 | |||
c1bc070b40 | |||
930eeaf177 | |||
2dd29fbae7 | |||
9613660fee | |||
c0523fc3b4 | |||
de1cffb23b | |||
31f4557621 | |||
7723bfd9ba | |||
e8ea839df8 | |||
90cec40cce | |||
4036281007 | |||
164cd274a4 | |||
fedcfec346 | |||
618cb32407 | |||
4aee0087ea | |||
0681a20d28 |
@ -653,8 +653,10 @@ jobs:
|
|||||||
name: Starting Saucelabs tunnel service
|
name: Starting Saucelabs tunnel service
|
||||||
command: ./tools/saucelabs/sauce-service.sh run
|
command: ./tools/saucelabs/sauce-service.sh run
|
||||||
background: true
|
background: true
|
||||||
- run: yarn tsc -p packages
|
# add module umd tsc compile option so the test can work
|
||||||
- run: yarn tsc -p modules
|
# properly in the legacy browsers
|
||||||
|
- run: yarn tsc -p packages --module UMD
|
||||||
|
- run: yarn tsc -p modules --module UMD
|
||||||
- run: yarn bazel build //packages/zone.js:npm_package
|
- run: yarn bazel build //packages/zone.js:npm_package
|
||||||
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
|
# Build test fixtures for a test that rely on Bazel-generated fixtures. Note that disabling
|
||||||
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
|
# specific tests which are reliant on such generated fixtures is not an option as SystemJS
|
||||||
@ -747,6 +749,8 @@ jobs:
|
|||||||
cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/ &&
|
cp dist/bin/packages/zone.js/npm_package/bundles/zone-patch-electron.umd.js ./packages/zone.js/test/extra/ &&
|
||||||
yarn --cwd packages/zone.js electrontest
|
yarn --cwd packages/zone.js electrontest
|
||||||
- run: yarn --cwd packages/zone.js jesttest
|
- run: yarn --cwd packages/zone.js jesttest
|
||||||
|
- run: yarn --cwd packages/zone.js/test/typings install --frozen-lockfile --non-interactive
|
||||||
|
- run: yarn --cwd packages/zone.js/test/typings test
|
||||||
|
|
||||||
# Windows jobs
|
# Windows jobs
|
||||||
# Docs: https://circleci.com/docs/2.0/hello-world-windows/
|
# Docs: https://circleci.com/docs/2.0/hello-world-windows/
|
||||||
|
2
.github/ISSUE_TEMPLATE/1-bug-report.md
vendored
2
.github/ISSUE_TEMPLATE/1-bug-report.md
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F41EBug report"
|
name: "\U0001F41E Bug report"
|
||||||
about: Report a bug in the Angular Framework
|
about: Report a bug in the Angular Framework
|
||||||
---
|
---
|
||||||
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
|
<!--🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅🔅
|
||||||
|
2
.github/ISSUE_TEMPLATE/2-feature-request.md
vendored
2
.github/ISSUE_TEMPLATE/2-feature-request.md
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F680Feature request"
|
name: "\U0001F680 Feature request"
|
||||||
about: Suggest a feature for Angular Framework
|
about: Suggest a feature for Angular Framework
|
||||||
|
|
||||||
---
|
---
|
||||||
|
2
.github/ISSUE_TEMPLATE/5-support-request.md
vendored
2
.github/ISSUE_TEMPLATE/5-support-request.md
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "❓Support request"
|
name: "❓ Support request"
|
||||||
about: Questions and requests for support
|
about: Questions and requests for support
|
||||||
|
|
||||||
---
|
---
|
||||||
|
2
.github/ISSUE_TEMPLATE/6-angular-cli.md
vendored
2
.github/ISSUE_TEMPLATE/6-angular-cli.md
vendored
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F6E0️Angular CLI"
|
name: "\U0001F6E0️ Angular CLI"
|
||||||
about: Issues and feature requests for Angular CLI
|
about: Issues and feature requests for Angular CLI
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
name: "\U0001F48EAngular Components"
|
name: "\U0001F48E Angular Components"
|
||||||
about: Issues and feature requests for Angular Components
|
about: Issues and feature requests for Angular Components
|
||||||
|
|
||||||
---
|
---
|
||||||
|
30
.github/angular-robot.yml
vendored
30
.github/angular-robot.yml
vendored
@ -48,6 +48,7 @@ merge:
|
|||||||
- "packages/bazel/src/protractor/**"
|
- "packages/bazel/src/protractor/**"
|
||||||
- "packages/bazel/src/schematics/**"
|
- "packages/bazel/src/schematics/**"
|
||||||
- "packages/compiler-cli/ngcc/**"
|
- "packages/compiler-cli/ngcc/**"
|
||||||
|
- "packages/compiler-cli/src/ngtsc/sourcemaps/**",
|
||||||
- "packages/docs/**"
|
- "packages/docs/**"
|
||||||
- "packages/elements/schematics/**"
|
- "packages/elements/schematics/**"
|
||||||
- "packages/examples/**"
|
- "packages/examples/**"
|
||||||
@ -68,20 +69,20 @@ merge:
|
|||||||
- "packages/**/integrationtest/**"
|
- "packages/**/integrationtest/**"
|
||||||
- "packages/**/test/**"
|
- "packages/**/test/**"
|
||||||
- "packages/zone.js/*"
|
- "packages/zone.js/*"
|
||||||
|
- "packages/zone.js/dist/**"
|
||||||
- "packages/zone.js/doc/**"
|
- "packages/zone.js/doc/**"
|
||||||
- "packages/zone.js/example/**"
|
- "packages/zone.js/example/**"
|
||||||
- "packages/zone.js/scripts/**"
|
- "packages/zone.js/scripts/**"
|
||||||
|
|
||||||
# comment that will be added to a PR when there is a conflict, leave empty or set to false to disable
|
# comment that will be added to a PR when there is a conflict, leave empty or set to false to disable
|
||||||
mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges.
|
mergeConflictComment: "Hi @{{PRAuthor}}! This PR has merge conflicts due to recent upstream merges.\nPlease help to unblock it by resolving these conflicts. Thanks!"
|
||||||
\nPlease help to unblock it by resolving these conflicts. Thanks!"
|
|
||||||
|
|
||||||
# label to monitor
|
# label to monitor
|
||||||
mergeLabel: "PR action: merge"
|
mergeLabel: "action: merge"
|
||||||
|
|
||||||
# adding any of these labels will also add the merge label
|
# adding any of these labels will also add the merge label
|
||||||
mergeLinkedLabels:
|
mergeLinkedLabels:
|
||||||
- "PR action: merge-assistance"
|
- "action: merge-assistance"
|
||||||
|
|
||||||
# list of checks that will determine if the merge label can be added
|
# list of checks that will determine if the merge label can be added
|
||||||
checks:
|
checks:
|
||||||
@ -94,17 +95,17 @@ merge:
|
|||||||
|
|
||||||
# whether the PR shouldn't have a conflict with the base branch
|
# whether the PR shouldn't have a conflict with the base branch
|
||||||
noConflict: true
|
noConflict: true
|
||||||
# list of labels that a PR needs to have, checked with a regexp (e.g. "PR target:" will work for the label "PR target: master")
|
# list of labels that a PR needs to have, checked with a regexp (e.g. "target:" will work for the label "target: master")
|
||||||
requiredLabels:
|
requiredLabels:
|
||||||
- "PR target: *"
|
- "target: *"
|
||||||
- "cla: yes"
|
- "cla: yes"
|
||||||
|
|
||||||
# list of labels that a PR shouldn't have, checked after the required labels with a regexp
|
# list of labels that a PR shouldn't have, checked after the required labels with a regexp
|
||||||
forbiddenLabels:
|
forbiddenLabels:
|
||||||
- "PR target: TBD"
|
- "target: TBD"
|
||||||
- "PR action: cleanup"
|
- "action: cleanup"
|
||||||
- "PR action: review"
|
- "action: review"
|
||||||
- "PR state: blocked"
|
- "state: blocked"
|
||||||
- "cla: no"
|
- "cla: no"
|
||||||
|
|
||||||
# list of PR statuses that need to be successful
|
# list of PR statuses that need to be successful
|
||||||
@ -121,12 +122,7 @@ merge:
|
|||||||
# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable
|
# the comment that will be added when the merge label is added despite failing checks, leave empty or set to false to disable
|
||||||
# {{MERGE_LABEL}} will be replaced by the value of the mergeLabel option
|
# {{MERGE_LABEL}} will be replaced by the value of the mergeLabel option
|
||||||
# {{PLACEHOLDER}} will be replaced by the list of failing checks
|
# {{PLACEHOLDER}} will be replaced by the list of failing checks
|
||||||
mergeRemovedComment: "I see that you just added the `{{MERGE_LABEL}}` label, but the following checks are still failing:
|
mergeRemovedComment: "I see that you just added the `{{MERGE_LABEL}}` label, but the following checks are still failing:\n{{PLACEHOLDER}}\n\n**If you want your PR to be merged, it has to pass all the CI checks.**\n\nIf you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help."
|
||||||
\n{{PLACEHOLDER}}
|
|
||||||
\n
|
|
||||||
\n**If you want your PR to be merged, it has to pass all the CI checks.**
|
|
||||||
\n
|
|
||||||
\nIf you can't get the PR to a green state due to flakes or broken master, please try rebasing to master and/or restarting the CI job. If that fails and you believe that the issue is not due to your change, please contact the caretaker and ask for help."
|
|
||||||
|
|
||||||
# options for the triage plugin
|
# options for the triage plugin
|
||||||
triage:
|
triage:
|
||||||
@ -186,4 +182,4 @@ rerunCircleCI:
|
|||||||
# set to true to disable
|
# set to true to disable
|
||||||
disabled: false
|
disabled: false
|
||||||
# the label which when added triggers a rerun of the default CircleCI workflow
|
# the label which when added triggers a rerun of the default CircleCI workflow
|
||||||
triggerRerunLabel: "PR action: rerun CI at HEAD"
|
triggerRerunLabel: "action: rerun CI at HEAD"
|
||||||
|
2
.github/workflows/lock-closed.yml
vendored
2
.github/workflows/lock-closed.yml
vendored
@ -10,6 +10,6 @@ jobs:
|
|||||||
if: github.repository == 'angular/angular'
|
if: github.repository == 'angular/angular'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: angular/dev-infra/github-actions/lock-closed@66462f6
|
- uses: angular/dev-infra/github-actions/lock-closed@414834b2b24dd2df37c6ed00808387ee6fd91b66
|
||||||
with:
|
with:
|
||||||
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}
|
lock-bot-key: ${{ secrets.LOCK_BOT_PRIVATE_KEY }}
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -40,6 +40,9 @@ yarn-error.log
|
|||||||
# User specific bazel settings
|
# User specific bazel settings
|
||||||
.bazelrc.user
|
.bazelrc.user
|
||||||
|
|
||||||
|
# User specific ng-dev settings
|
||||||
|
.ng-dev.user*
|
||||||
|
|
||||||
.notes.md
|
.notes.md
|
||||||
baseline.json
|
baseline.json
|
||||||
|
|
||||||
|
@ -105,9 +105,9 @@ Fixes #<issue number>
|
|||||||
# │ │
|
# │ │
|
||||||
# │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
|
# │ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
|
||||||
# │ elements|forms|http|language-service|localize|platform-browser|
|
# │ elements|forms|http|language-service|localize|platform-browser|
|
||||||
# │ platform-browser-dynamic|platform-server|platform-webworker|
|
# │ platform-browser-dynamic|platform-server|router|service-worker|
|
||||||
# │ platform-webworker-dynamic|router|service-worker|upgrade|zone.js|
|
# │ upgrade|zone.js|packaging|changelog|dev-infra|docs-infra|migrations|
|
||||||
# │ packaging|changelog|dev-infra|docs-infra|migrations|ngcc|ve
|
# │ ngcc|ve
|
||||||
# │ https://github.com/angular/angular/blob/master/CONTRIBUTING.md#scope
|
# │ https://github.com/angular/angular/blob/master/CONTRIBUTING.md#scope
|
||||||
# │
|
# │
|
||||||
# └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
|
# └─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
|
||||||
|
19
.ng-dev/caretaker.ts
Normal file
19
.ng-dev/caretaker.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import {CaretakerConfig} from '../dev-infra/caretaker/config';
|
||||||
|
|
||||||
|
/** The configuration for `ng-dev caretaker` commands. */
|
||||||
|
export const caretaker: CaretakerConfig = {
|
||||||
|
githubQueries: [
|
||||||
|
{
|
||||||
|
name: 'Merge Queue',
|
||||||
|
query: `is:pr is:open status:success label:"action: merge"`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Merge Assistance Queue',
|
||||||
|
query: `is:pr is:open status:success label:"action: merge-assistance"`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Primary Triage Queue',
|
||||||
|
query: `is:open is:issue no:milestone`,
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
@ -1,11 +1,15 @@
|
|||||||
|
import {caretaker} from './caretaker';
|
||||||
import {commitMessage} from './commit-message';
|
import {commitMessage} from './commit-message';
|
||||||
import {format} from './format';
|
import {format} from './format';
|
||||||
import {github} from './github';
|
import {github} from './github';
|
||||||
import {merge} from './merge';
|
import {merge} from './merge';
|
||||||
|
import {release} from './release';
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
commitMessage,
|
commitMessage,
|
||||||
format,
|
format,
|
||||||
github,
|
github,
|
||||||
merge,
|
merge,
|
||||||
|
caretaker,
|
||||||
|
release,
|
||||||
};
|
};
|
||||||
|
@ -1,38 +1,28 @@
|
|||||||
import {MergeConfig} from '../dev-infra/pr/merge/config';
|
import {DevInfraMergeConfig} from '../dev-infra/pr/merge/config';
|
||||||
|
import {getDefaultTargetLabelConfiguration} from '../dev-infra/pr/merge/defaults';
|
||||||
|
import {github} from './github';
|
||||||
|
import {release} from './release';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
|
* Configuration for the merge tool in `ng-dev`. This sets up the labels which
|
||||||
* are respected by the merge script (e.g. the target labels).
|
* are respected by the merge script (e.g. the target labels).
|
||||||
*/
|
*/
|
||||||
export const merge = (): MergeConfig => {
|
export const merge: DevInfraMergeConfig['merge'] = async api => {
|
||||||
// TODO: resume dynamically determining patch branch
|
|
||||||
const patch = '10.0.x';
|
|
||||||
return {
|
return {
|
||||||
githubApiMerge: false,
|
githubApiMerge: false,
|
||||||
claSignedLabel: 'cla: yes',
|
claSignedLabel: 'cla: yes',
|
||||||
mergeReadyLabel: /^PR action: merge(-assistance)?/,
|
mergeReadyLabel: /^action: merge(-assistance)?/,
|
||||||
caretakerNoteLabel: 'PR action: merge-assistance',
|
caretakerNoteLabel: 'action: merge-assistance',
|
||||||
commitMessageFixupLabel: 'commit message fixup',
|
commitMessageFixupLabel: 'commit message fixup',
|
||||||
labels: [
|
// We can pick any of the NPM packages as we are in a monorepo where all packages are
|
||||||
{
|
// published together with the same version and branching.
|
||||||
pattern: 'PR target: master-only',
|
labels: await getDefaultTargetLabelConfiguration(api, github, release),
|
||||||
branches: ['master'],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
pattern: 'PR target: patch-only',
|
|
||||||
branches: [patch],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
pattern: 'PR target: master & patch',
|
|
||||||
branches: ['master', patch],
|
|
||||||
},
|
|
||||||
],
|
|
||||||
requiredBaseCommits: {
|
requiredBaseCommits: {
|
||||||
// PRs that target either `master` or the patch branch, need to be rebased
|
// PRs that target either `master` or the patch branch, need to be rebased
|
||||||
// on top of the latest commit message validation fix.
|
// on top of the latest commit message validation fix.
|
||||||
// These SHAs are the commits that update the required license text in the header.
|
// These SHAs are the commits that update the required license text in the header.
|
||||||
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
|
'master': '5aeb9a4124922d8ac08eb73b8f322905a32b0b3a',
|
||||||
[patch]: '27b95ba64a5d99757f4042073fd1860e20e3ed24'
|
'10.0.x': '27b95ba64a5d99757f4042073fd1860e20e3ed24',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
33
.ng-dev/release.ts
Normal file
33
.ng-dev/release.ts
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
import {join} from 'path';
|
||||||
|
import {exec} from 'shelljs';
|
||||||
|
import {ReleaseConfig} from '../dev-infra/release/config';
|
||||||
|
|
||||||
|
/** Configuration for the `ng-dev release` command. */
|
||||||
|
export const release: ReleaseConfig = {
|
||||||
|
npmPackages: [
|
||||||
|
'@angular/animations',
|
||||||
|
'@angular/bazel',
|
||||||
|
'@angular/common',
|
||||||
|
'@angular/compiler',
|
||||||
|
'@angular/compiler-cli',
|
||||||
|
'@angular/core',
|
||||||
|
'@angular/elements',
|
||||||
|
'@angular/forms',
|
||||||
|
'@angular/language-service',
|
||||||
|
'@angular/localize',
|
||||||
|
'@angular/platform-browser',
|
||||||
|
'@angular/platform-browser-dynamic',
|
||||||
|
'@angular/platform-server',
|
||||||
|
'@angular/platform-webworker',
|
||||||
|
'@angular/platform-webworker-dynamic',
|
||||||
|
'@angular/router',
|
||||||
|
'@angular/service-worker',
|
||||||
|
'@angular/upgrade',
|
||||||
|
],
|
||||||
|
// TODO: Implement release package building here.
|
||||||
|
buildPackages: async () => [],
|
||||||
|
// TODO: This can be removed once there is a org-wide tool for changelog generation.
|
||||||
|
generateReleaseNotesForHead: async () => {
|
||||||
|
exec('yarn -s gulp changelog', {cwd: join(__dirname, '../')});
|
||||||
|
},
|
||||||
|
};
|
@ -284,7 +284,7 @@ groups:
|
|||||||
users:
|
users:
|
||||||
- alxhub
|
- alxhub
|
||||||
- crisbeto
|
- crisbeto
|
||||||
- devversion
|
# OOO as of 2020-09-28 - devversion
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
@ -303,8 +303,6 @@ groups:
|
|||||||
'packages/platform-browser/**',
|
'packages/platform-browser/**',
|
||||||
'packages/examples/platform-browser/**',
|
'packages/examples/platform-browser/**',
|
||||||
'packages/platform-browser-dynamic/**',
|
'packages/platform-browser-dynamic/**',
|
||||||
'packages/platform-webworker/**',
|
|
||||||
'packages/platform-webworker-dynamic/**',
|
|
||||||
'packages/examples/common/**',
|
'packages/examples/common/**',
|
||||||
'packages/docs/**',
|
'packages/docs/**',
|
||||||
'aio/content/guide/accessibility.md',
|
'aio/content/guide/accessibility.md',
|
||||||
@ -419,7 +417,7 @@ groups:
|
|||||||
- atscott
|
- atscott
|
||||||
- ~kara # do not request reviews from Kara, but allow her to approve PRs
|
- ~kara # do not request reviews from Kara, but allow her to approve PRs
|
||||||
- mhevery
|
- mhevery
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
@ -662,7 +660,7 @@ groups:
|
|||||||
users:
|
users:
|
||||||
- AndrewKushnir
|
- AndrewKushnir
|
||||||
- IgorMinar
|
- IgorMinar
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
@ -679,7 +677,7 @@ groups:
|
|||||||
reviewers:
|
reviewers:
|
||||||
users:
|
users:
|
||||||
- IgorMinar
|
- IgorMinar
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
@ -697,7 +695,7 @@ groups:
|
|||||||
users:
|
users:
|
||||||
- IgorMinar
|
- IgorMinar
|
||||||
- jelbourn
|
- jelbourn
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
|
|
||||||
|
|
||||||
# =========================================================
|
# =========================================================
|
||||||
@ -723,7 +721,7 @@ groups:
|
|||||||
- IgorMinar
|
- IgorMinar
|
||||||
- mhevery
|
- mhevery
|
||||||
- jelbourn
|
- jelbourn
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
reviews:
|
reviews:
|
||||||
request: -1 # request reviews from everyone
|
request: -1 # request reviews from everyone
|
||||||
required: 2 # require at least 2 approvals
|
required: 2 # require at least 2 approvals
|
||||||
@ -1150,7 +1148,7 @@ groups:
|
|||||||
])
|
])
|
||||||
reviewers:
|
reviewers:
|
||||||
users:
|
users:
|
||||||
- devversion
|
# OOO as of 2020-09-28 - devversion
|
||||||
- filipesilva
|
- filipesilva
|
||||||
- gkalpak
|
- gkalpak
|
||||||
- IgorMinar
|
- IgorMinar
|
||||||
@ -1184,7 +1182,7 @@ groups:
|
|||||||
- atscott
|
- atscott
|
||||||
- jelbourn
|
- jelbourn
|
||||||
- petebacondarwin
|
- petebacondarwin
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
reviews:
|
reviews:
|
||||||
request: 4 # Request reviews from four people
|
request: 4 # Request reviews from four people
|
||||||
required: 3 # Require that three people approve
|
required: 3 # Require that three people approve
|
||||||
@ -1212,7 +1210,7 @@ groups:
|
|||||||
- atscott
|
- atscott
|
||||||
- jelbourn
|
- jelbourn
|
||||||
- petebacondarwin
|
- petebacondarwin
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
reviews:
|
reviews:
|
||||||
request: 4 # Request reviews from four people
|
request: 4 # Request reviews from four people
|
||||||
required: 2 # Require that two people approve
|
required: 2 # Require that two people approve
|
||||||
@ -1240,7 +1238,7 @@ groups:
|
|||||||
- atscott
|
- atscott
|
||||||
- jelbourn
|
- jelbourn
|
||||||
- petebacondarwin
|
- petebacondarwin
|
||||||
- pkozlowski-opensource
|
# OOO as of 2020-09-28 - pkozlowski-opensource
|
||||||
|
|
||||||
|
|
||||||
####################################################################################
|
####################################################################################
|
||||||
|
@ -44654,7 +44654,7 @@ const FOLDERS_IGNORE = [
|
|||||||
const DEFAULT_IGNORE = (0, (_filter || _load_filter()).ignoreLinesToRegex)([...FOLDERS_IGNORE,
|
const DEFAULT_IGNORE = (0, (_filter || _load_filter()).ignoreLinesToRegex)([...FOLDERS_IGNORE,
|
||||||
|
|
||||||
// ignore cruft
|
// ignore cruft
|
||||||
'yarn.lock', '.lock-wscript', '.wafpickle-{0..9}', '*.swp', '._*', 'npm-debug.log', 'yarn-error.log', '.npmrc', '.yarnrc', '.npmignore', '.gitignore', '.DS_Store']);
|
'yarn.lock', '.lock-wscript', '.wafpickle-{0..9}', '*.swp', '._*', 'npm-debug.log', 'yarn-error.log', '.npmrc', '.yarnrc', '.yarnrc.yml', '.npmignore', '.gitignore', '.DS_Store']);
|
||||||
|
|
||||||
const NEVER_IGNORE = (0, (_filter || _load_filter()).ignoreLinesToRegex)([
|
const NEVER_IGNORE = (0, (_filter || _load_filter()).ignoreLinesToRegex)([
|
||||||
// never ignore these files
|
// never ignore these files
|
||||||
@ -44663,6 +44663,7 @@ const NEVER_IGNORE = (0, (_filter || _load_filter()).ignoreLinesToRegex)([
|
|||||||
function packWithIgnoreAndHeaders(cwd, ignoreFunction, { mapHeader } = {}) {
|
function packWithIgnoreAndHeaders(cwd, ignoreFunction, { mapHeader } = {}) {
|
||||||
return tar.pack(cwd, {
|
return tar.pack(cwd, {
|
||||||
ignore: ignoreFunction,
|
ignore: ignoreFunction,
|
||||||
|
sort: true,
|
||||||
map: header => {
|
map: header => {
|
||||||
const suffix = header.name === '.' ? '' : `/${header.name}`;
|
const suffix = header.name === '.' ? '' : `/${header.name}`;
|
||||||
header.name = `package${suffix}`;
|
header.name = `package${suffix}`;
|
||||||
@ -46678,7 +46679,7 @@ function mkdirfix (name, opts, cb) {
|
|||||||
/* 194 */
|
/* 194 */
|
||||||
/***/ (function(module, exports) {
|
/***/ (function(module, exports) {
|
||||||
|
|
||||||
module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.4","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}
|
module.exports = {"name":"yarn","installationMethod":"unknown","version":"1.22.5","license":"BSD-2-Clause","preferGlobal":true,"description":"📦🐈 Fast, reliable, and secure dependency management.","dependencies":{"@zkochan/cmd-shim":"^3.1.0","babel-runtime":"^6.26.0","bytes":"^3.0.0","camelcase":"^4.0.0","chalk":"^2.1.0","cli-table3":"^0.4.0","commander":"^2.9.0","death":"^1.0.0","debug":"^3.0.0","deep-equal":"^1.0.1","detect-indent":"^5.0.0","dnscache":"^1.0.1","glob":"^7.1.1","gunzip-maybe":"^1.4.0","hash-for-dep":"^1.2.3","imports-loader":"^0.8.0","ini":"^1.3.4","inquirer":"^6.2.0","invariant":"^2.2.0","is-builtin-module":"^2.0.0","is-ci":"^1.0.10","is-webpack-bundle":"^1.0.0","js-yaml":"^3.13.1","leven":"^2.0.0","loud-rejection":"^1.2.0","micromatch":"^2.3.11","mkdirp":"^0.5.1","node-emoji":"^1.6.1","normalize-url":"^2.0.0","npm-logical-tree":"^1.2.1","object-path":"^0.11.2","proper-lockfile":"^2.0.0","puka":"^1.0.0","read":"^1.0.7","request":"^2.87.0","request-capture-har":"^1.2.2","rimraf":"^2.5.0","semver":"^5.1.0","ssri":"^5.3.0","strip-ansi":"^4.0.0","strip-bom":"^3.0.0","tar-fs":"^1.16.0","tar-stream":"^1.6.1","uuid":"^3.0.1","v8-compile-cache":"^2.0.0","validate-npm-package-license":"^3.0.4","yn":"^2.0.0"},"devDependencies":{"babel-core":"^6.26.0","babel-eslint":"^7.2.3","babel-loader":"^6.2.5","babel-plugin-array-includes":"^2.0.3","babel-plugin-inline-import":"^3.0.0","babel-plugin-transform-builtin-extend":"^1.1.2","babel-plugin-transform-inline-imports-commonjs":"^1.0.0","babel-plugin-transform-runtime":"^6.4.3","babel-preset-env":"^1.6.0","babel-preset-flow":"^6.23.0","babel-preset-stage-0":"^6.0.0","babylon":"^6.5.0","commitizen":"^2.9.6","cz-conventional-changelog":"^2.0.0","eslint":"^4.3.0","eslint-config-fb-strict":"^22.0.0","eslint-plugin-babel":"^5.0.0","eslint-plugin-flowtype":"^2.35.0","eslint-plugin-jasmine":"^2.6.2","eslint-plugin-jest":"^21.0.0","eslint-plugin-jsx-a11y":"^6.0.2","eslint-plugin-prefer-object-spread":"^1.2.1","eslint-plugin-prettier":"^2.1.2","eslint-plugin-react":"^7.1.0","eslint-plugin-relay":"^0.0.28","eslint-plugin-yarn-internal":"file:scripts/eslint-rules","execa":"^0.11.0","fancy-log":"^1.3.2","flow-bin":"^0.66.0","git-release-notes":"^3.0.0","gulp":"^4.0.0","gulp-babel":"^7.0.0","gulp-if":"^2.0.1","gulp-newer":"^1.0.0","gulp-plumber":"^1.0.1","gulp-sourcemaps":"^2.2.0","jest":"^22.4.4","jsinspect":"^0.12.6","minimatch":"^3.0.4","mock-stdin":"^0.3.0","prettier":"^1.5.2","string-replace-loader":"^2.1.1","temp":"^0.8.3","webpack":"^2.1.0-beta.25","yargs":"^6.3.0"},"resolutions":{"sshpk":"^1.14.2"},"engines":{"node":">=4.0.0"},"repository":"yarnpkg/yarn","bin":{"yarn":"./bin/yarn.js","yarnpkg":"./bin/yarn.js"},"scripts":{"build":"gulp build","build-bundle":"node ./scripts/build-webpack.js","build-chocolatey":"powershell ./scripts/build-chocolatey.ps1","build-deb":"./scripts/build-deb.sh","build-dist":"bash ./scripts/build-dist.sh","build-win-installer":"scripts\\build-windows-installer.bat","changelog":"git-release-notes $(git describe --tags --abbrev=0 $(git describe --tags --abbrev=0)^)..$(git describe --tags --abbrev=0) scripts/changelog.md","dupe-check":"yarn jsinspect ./src","lint":"eslint . && flow check","pkg-tests":"yarn --cwd packages/pkg-tests jest yarn.test.js","prettier":"eslint src __tests__ --fix","release-branch":"./scripts/release-branch.sh","test":"yarn lint && yarn test-only","test-only":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --verbose","test-only-debug":"node --inspect-brk --max_old_space_size=4096 node_modules/jest/bin/jest.js --runInBand --verbose","test-coverage":"node --max_old_space_size=4096 node_modules/jest/bin/jest.js --coverage --verbose","watch":"gulp watch","commit":"git-cz"},"jest":{"collectCoverageFrom":["src/**/*.js"],"testEnvironment":"node","modulePathIgnorePatterns":["__tests__/fixtures/","packages/pkg-tests/pkg-tests-fixtures","dist/"],"testPathIgnorePatterns":["__tests__/(fixtures|__mocks__)/","updates/","_(temp|mock|install|init|helpers).js$","packages/pkg-tests"]},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}
|
||||||
|
|
||||||
/***/ }),
|
/***/ }),
|
||||||
/* 195 */
|
/* 195 */
|
||||||
@ -98338,7 +98339,7 @@ var _buildSubCommands = (0, (_buildSubCommands2 || _load_buildSubCommands()).def
|
|||||||
|
|
||||||
const bundle = yield fetchBundle(config, bundleUrl);
|
const bundle = yield fetchBundle(config, bundleUrl);
|
||||||
|
|
||||||
const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.js`);
|
const yarnPath = path.resolve(config.lockfileFolder, `.yarn/releases/yarn-${bundleVersion}.cjs`);
|
||||||
reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`);
|
reporter.log(`Saving it into ${chalk.magenta(yarnPath)}...`);
|
||||||
yield (_fs || _load_fs()).mkdirp(path.dirname(yarnPath));
|
yield (_fs || _load_fs()).mkdirp(path.dirname(yarnPath));
|
||||||
yield (_fs || _load_fs()).writeFile(yarnPath, bundle);
|
yield (_fs || _load_fs()).writeFile(yarnPath, bundle);
|
||||||
@ -100190,7 +100191,7 @@ let main = exports.main = (() => {
|
|||||||
|
|
||||||
const config = new (_config || _load_config()).default(reporter);
|
const config = new (_config || _load_config()).default(reporter);
|
||||||
const outputWrapperEnabled = (0, (_conversion || _load_conversion()).boolifyWithDefault)(process.env.YARN_WRAP_OUTPUT, true);
|
const outputWrapperEnabled = (0, (_conversion || _load_conversion()).boolifyWithDefault)(process.env.YARN_WRAP_OUTPUT, true);
|
||||||
const shouldWrapOutput = outputWrapperEnabled && !(_commander || _load_commander()).default.json && command.hasWrapper((_commander || _load_commander()).default, (_commander || _load_commander()).default.args);
|
const shouldWrapOutput = outputWrapperEnabled && !(_commander || _load_commander()).default.json && command.hasWrapper((_commander || _load_commander()).default, (_commander || _load_commander()).default.args) && !(commandName === 'init' && (_commander || _load_commander()).default[`2`]);
|
||||||
|
|
||||||
if (shouldWrapOutput) {
|
if (shouldWrapOutput) {
|
||||||
reporter.header(commandName, { name: 'yarn', version: (_yarnVersion || _load_yarnVersion()).version });
|
reporter.header(commandName, { name: 'yarn', version: (_yarnVersion || _load_yarnVersion()).version });
|
||||||
@ -100604,7 +100605,7 @@ let start = (() => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (yarnPath.endsWith(`.js`)) {
|
if (/\.[cm]?js$/.test(yarnPath)) {
|
||||||
exitCode = yield (0, (_child || _load_child()).spawnp)(process.execPath, [yarnPath, ...argv], opts);
|
exitCode = yield (0, (_child || _load_child()).spawnp)(process.execPath, [yarnPath, ...argv], opts);
|
||||||
} else {
|
} else {
|
||||||
exitCode = yield (0, (_child || _load_child()).spawnp)(yarnPath, argv, opts);
|
exitCode = yield (0, (_child || _load_child()).spawnp)(yarnPath, argv, opts);
|
2
.yarnrc
2
.yarnrc
@ -2,4 +2,4 @@
|
|||||||
# yarn lockfile v1
|
# yarn lockfile v1
|
||||||
|
|
||||||
|
|
||||||
yarn-path ".yarn/releases/yarn-1.22.4.js"
|
yarn-path ".yarn/releases/yarn-1.22.5.js"
|
||||||
|
@ -34,7 +34,7 @@ filegroup(
|
|||||||
filegroup(
|
filegroup(
|
||||||
name = "angularjs_scripts",
|
name = "angularjs_scripts",
|
||||||
srcs = [
|
srcs = [
|
||||||
# We also declare the unminfied AngularJS files since these can be used for
|
# We also declare the unminified AngularJS files since these can be used for
|
||||||
# local debugging (e.g. see: packages/upgrade/test/common/test_helpers.ts)
|
# local debugging (e.g. see: packages/upgrade/test/common/test_helpers.ts)
|
||||||
"@npm//:node_modules/angular/angular.js",
|
"@npm//:node_modules/angular/angular.js",
|
||||||
"@npm//:node_modules/angular/angular.min.js",
|
"@npm//:node_modules/angular/angular.min.js",
|
||||||
|
524
CHANGELOG.md
524
CHANGELOG.md
@ -1,11 +1,358 @@
|
|||||||
<a name="10.1.0-rc.0"></a>
|
<a name="11.0.0-next.4"></a>
|
||||||
# 10.1.0-rc.0 (2020-08-26)
|
# 11.0.0-next.4 (2020-09-30)
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **common:** correct and simplify typing of `KeyValuePipe` ([#37447](https://github.com/angular/angular/issues/37447)) ([4dfe0fa](https://github.com/angular/angular/commit/4dfe0fa))
|
||||||
|
* **common:** correct and simplify typing of AsyncPipe ([#37447](https://github.com/angular/angular/issues/37447)) ([5f815c0](https://github.com/angular/angular/commit/5f815c0))
|
||||||
|
* **common:** correct and simplify typing of I18nPluralPipe ([#37447](https://github.com/angular/angular/issues/37447)) ([3b919ef](https://github.com/angular/angular/commit/3b919ef))
|
||||||
|
* **common:** correct typing and implementation of `SlicePipe` ([#37447](https://github.com/angular/angular/issues/37447)) ([4744c22](https://github.com/angular/angular/commit/4744c22))
|
||||||
|
* **common:** let case conversion pipes accept type unions with `null` ([#36259](https://github.com/angular/angular/issues/36259)) ([#37447](https://github.com/angular/angular/issues/37447)) ([c7d5555](https://github.com/angular/angular/commit/c7d5555))
|
||||||
|
* **compiler-cli:** perform DOM schema checks even in basic mode in g3 ([#38943](https://github.com/angular/angular/issues/38943)) ([40975e0](https://github.com/angular/angular/commit/40975e0))
|
||||||
|
* **language-service:** hybrid visitor returns parent node of BoundAttribute ([#38995](https://github.com/angular/angular/issues/38995)) ([323be39](https://github.com/angular/angular/commit/323be39))
|
||||||
|
* **packaging:** remove polyfills needed to run tests on IE9 and IE 10 ([#38931](https://github.com/angular/angular/issues/38931)) ([4ca1c73](https://github.com/angular/angular/commit/4ca1c73))
|
||||||
|
* **platform-webworker:** remove platform-webworker and platform-webworker-dynamic ([#38846](https://github.com/angular/angular/issues/38846)) ([93c3d8f](https://github.com/angular/angular/commit/93c3d8f))
|
||||||
|
* **router:** make relativeLinkResolution corrected by default ([#25609](https://github.com/angular/angular/issues/25609)) ([837889f](https://github.com/angular/angular/commit/837889f)), closes [#22394](https://github.com/angular/angular/issues/22394)
|
||||||
|
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
|
||||||
|
* **router:** Adjust type of parameter in navigateByUrl and createUrlTree to be more accurate ([#38227](https://github.com/angular/angular/issues/38227)) ([e4f4d18](https://github.com/angular/angular/commit/e4f4d18)), closes [#18798](https://github.com/angular/angular/issues/18798)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **common:** stricter types for DatePipe ([#37447](https://github.com/angular/angular/issues/37447)) ([daf8b7f](https://github.com/angular/angular/commit/daf8b7f))
|
||||||
|
* **common:** stricter types for number pipes ([#37447](https://github.com/angular/angular/issues/37447)) ([7b2aac9](https://github.com/angular/angular/commit/7b2aac9))
|
||||||
|
* **compiler:** Add keySpan to Variable Node ([#38965](https://github.com/angular/angular/issues/38965)) ([239968d](https://github.com/angular/angular/commit/239968d))
|
||||||
|
* **router:** Add `relativeLinkResolution` migration to update default value ([#38698](https://github.com/angular/angular/issues/38698)) ([15ea811](https://github.com/angular/angular/commit/15ea811))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **packaging:** In v10, IE 9, 10, and IE mobile support was deprecated. In v11, Angular framework removes IE 9,
|
||||||
|
10, and IE mobile support completely.
|
||||||
|
Supporting outdated browsers like these increases bundle size, code complexity, and test load,
|
||||||
|
and also requires time and effort that could be spent on improvements to the framework.
|
||||||
|
For example, fixing issues can be more difficult, as a straightforward fix for modern browsers
|
||||||
|
could break old ones that have quirks due to not receiving updates from vendors.
|
||||||
|
* **platform-webworker:** @angular/platform-webworker and @angular/platform-webworker-dynamic
|
||||||
|
have been removed as they were deprecated in v8
|
||||||
|
* **common:** The `slice` pipe now returns `null` for the `undefined` input value,
|
||||||
|
which is consistent with the behavior of most pipes. If you rely on
|
||||||
|
`undefined` being the result in that case, you now need to check for it
|
||||||
|
explicitly.
|
||||||
|
* **common:** The typing of the `keyvalue` pipe has been fixed to report that for
|
||||||
|
input objects that have `number` keys, the result will contain the
|
||||||
|
string representation of the keys. This was already the case and the
|
||||||
|
code has simply been updated to reflect this. Please update the
|
||||||
|
consumers of the pipe output if they were relying on the incorrect
|
||||||
|
types. Note that this does not affect use cases where the input values
|
||||||
|
are `Map`s, so if you need to preserve `number`s, this is an effective
|
||||||
|
way.
|
||||||
|
* **common:** The signatures of the number pipes now explicitly state which types are
|
||||||
|
accepted. This should only cause issues in corner cases, as any other
|
||||||
|
values would result in runtime exceptions.
|
||||||
|
* **common:** The signature of the `date` pipe now explicitly states which types are
|
||||||
|
accepted. This should only cause issues in corner cases, as any other
|
||||||
|
values would result in runtime exceptions.
|
||||||
|
* **common:** The async pipe no longer claims to return `undefined` for an input that
|
||||||
|
was typed as `undefined`. Note that the code actually returned `null` on
|
||||||
|
`undefined` inputs. In the unlikely case you were relying on this,
|
||||||
|
please fix the typing of the consumers of the pipe output.
|
||||||
|
* **common:** The case conversion pipes no longer let falsy values through. They now
|
||||||
|
map both `null` and `undefined` to `null` and raise an exception on
|
||||||
|
invalid input (`0`, `false`, `NaN`) just like most "common pipes". If
|
||||||
|
your code required falsy values to pass through, you need to handle them
|
||||||
|
explicitly.
|
||||||
|
* **router:** While the new parameter types allow a variable of type
|
||||||
|
`NavigationExtras` to be passed in, they will not allow object literals,
|
||||||
|
as they may only specify known properties. They will also not accept
|
||||||
|
types that do not have properties in common with the ones in the `Pick`.
|
||||||
|
To fix this error, only specify properties from the `NavigationExtras` which are
|
||||||
|
actually used in the respective function calls or use a type assertion
|
||||||
|
on the object or variable: `as NavigationExtras`.
|
||||||
|
* **router:** This commit changes the default value of
|
||||||
|
`relativeLinkResolution` from `'legacy'` to `'default'`. If your
|
||||||
|
application previously used the default by not specifying a value in the
|
||||||
|
`ExtraOptions` and uses relative links when navigating from children of
|
||||||
|
empty path routes, you will need to update your `RouterModule` to
|
||||||
|
specifically specify `'legacy'` for `relativeLinkResolution`.
|
||||||
|
See https://angular.io/api/router/ExtraOptions#relativeLinkResolution
|
||||||
|
for more details.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="10.1.4"></a>
|
||||||
|
## 10.1.4 (2020-09-30)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **compiler-cli:** enable [@types](https://github.com/types) discovery in incremental rebuilds ([#39011](https://github.com/angular/angular/issues/39011)) ([6e99427](https://github.com/angular/angular/commit/6e99427)), closes [#38979](https://github.com/angular/angular/issues/38979)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="11.0.0-next.3"></a>
|
||||||
|
# 11.0.0-next.3 (2020-09-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **common:** add `params` and `reportProgress` options to `HttpClient.put()` overload ([#37873](https://github.com/angular/angular/issues/37873)) ([dd8d8c8](https://github.com/angular/angular/commit/dd8d8c8)), closes [#23600](https://github.com/angular/angular/issues/23600)
|
||||||
|
* **compiler-cli:** generate `let` statements in ES2015+ mode ([#38775](https://github.com/angular/angular/issues/38775)) ([123bff7](https://github.com/angular/angular/commit/123bff7))
|
||||||
|
* **core:** ensure TestBed is not instantiated before override provider ([#38717](https://github.com/angular/angular/issues/38717)) ([c8f056b](https://github.com/angular/angular/commit/c8f056b))
|
||||||
|
* **forms:** type NG_VALUE_ACCESSOR injection token as array ([#29723](https://github.com/angular/angular/issues/29723)) ([2b1b718](https://github.com/angular/angular/commit/2b1b718)), closes [#29351](https://github.com/angular/angular/issues/29351)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **common:** Add ISO week-numbering year formats support to formatDate ([#38828](https://github.com/angular/angular/issues/38828)) ([984ed39](https://github.com/angular/angular/commit/984ed39))
|
||||||
|
* **compiler:** Parse and recover on incomplete opening HTML tags ([#38681](https://github.com/angular/angular/issues/38681)) ([6ae3b68](https://github.com/angular/angular/commit/6ae3b68)), closes [#38596](https://github.com/angular/angular/issues/38596)
|
||||||
|
* **router:** add migration to update calls to navigateByUrl and createUrlTree with invalid parameters ([#38825](https://github.com/angular/angular/issues/38825)) ([7849fdd](https://github.com/angular/angular/commit/7849fdd)), closes [#38227](https://github.com/angular/angular/issues/38227)
|
||||||
|
* **service-worker:** add the option to prefer network for navigation requests ([#38565](https://github.com/angular/angular/issues/38565)) ([a206852](https://github.com/angular/angular/commit/a206852)), closes [#38194](https://github.com/angular/angular/issues/38194)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **core:** If you call `TestBed.overrideProvider` after TestBed initialization, provider overrides are not applied. This
|
||||||
|
behavior is consistent with other override methods (such as `TestBed.overrideDirective`, etc) but they
|
||||||
|
throw an error to indicate that, when the check was missing in the `TestBed.overrideProvider` function.
|
||||||
|
Now calling `TestBed.overrideProvider` after TestBed initialization also triggers an
|
||||||
|
error, thus there is a chance that some tests (where `TestBed.overrideProvider` is
|
||||||
|
called after TestBed initialization) will start to fail and require updates to move `TestBed.overrideProvider` calls
|
||||||
|
before TestBed initialization is completed.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="10.1.3"></a>
|
||||||
|
## 10.1.3 (2020-09-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **http:** Fix error message when we call jsonp without importing HttpClientJsonpModule ([#38756](https://github.com/angular/angular/issues/38756)) ([3902ec0](https://github.com/angular/angular/commit/3902ec0))
|
||||||
|
* **ngcc:** fix compilation of `ChangeDetectorRef` in pipe constructors ([#38892](https://github.com/angular/angular/issues/38892)) ([093c3a1](https://github.com/angular/angular/commit/093c3a1)), closes [#38666](https://github.com/angular/angular/issues/38666) [#38883](https://github.com/angular/angular/issues/38883)
|
||||||
|
|
||||||
|
|
||||||
|
### Reverts
|
||||||
|
|
||||||
|
* feat(router): better warning message when a router outlet has not been instantiated ([#38920](https://github.com/angular/angular/issues/38920)) ([04d0aa6](https://github.com/angular/angular/commit/04d0aa6))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="11.0.0-next.2"></a>
|
||||||
|
# 11.0.0-next.2 (2020-09-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **common:** do not round up fractions of a millisecond in `DatePipe` ([#38009](https://github.com/angular/angular/issues/38009)) ([26f2820](https://github.com/angular/angular/commit/26f2820)), closes [/www.ecma-international.org/ecma-262/5.1/#sec-15](https://github.com//www.ecma-international.org/ecma-262/5.1//issues/sec-15) [#37989](https://github.com/angular/angular/issues/37989)
|
||||||
|
* **common:** mark locale data arrays as readonly ([#30397](https://github.com/angular/angular/issues/30397)) ([6acea54](https://github.com/angular/angular/commit/6acea54)), closes [#27003](https://github.com/angular/angular/issues/27003)
|
||||||
|
* **compiler:** source span for microsyntax text att should be key span ([#38766](https://github.com/angular/angular/issues/38766)) ([8f349b2](https://github.com/angular/angular/commit/8f349b2))
|
||||||
|
* **router:** Fix arguments order for call to shouldReuseRoute ([#26949](https://github.com/angular/angular/issues/26949)) ([3817e5f](https://github.com/angular/angular/commit/3817e5f)), closes [#16192](https://github.com/angular/angular/issues/16192) [#16192](https://github.com/angular/angular/issues/16192)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **compiler-cli:** `TemplateTypeChecker` operation to get `Symbol` from a template node ([#38618](https://github.com/angular/angular/issues/38618)) ([c4556db](https://github.com/angular/angular/commit/c4556db))
|
||||||
|
* **compiler-cli:** Add ability to get `Symbol` of `Template`s and `Element`s in component template ([#38618](https://github.com/angular/angular/issues/38618)) ([cf2e8b9](https://github.com/angular/angular/commit/cf2e8b9))
|
||||||
|
* **compiler-cli:** Add ability to get `Symbol` of AST expression in component template ([#38618](https://github.com/angular/angular/issues/38618)) ([f56ece4](https://github.com/angular/angular/commit/f56ece4))
|
||||||
|
* **compiler-cli:** add ability to get symbol of reference or variable ([#38618](https://github.com/angular/angular/issues/38618)) ([19598b4](https://github.com/angular/angular/commit/19598b4))
|
||||||
|
* **compiler-cli:** define interfaces to be used for TemplateTypeChecker ([#38618](https://github.com/angular/angular/issues/38618)) ([9e77bd3](https://github.com/angular/angular/commit/9e77bd3))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **compiler-cli:** only emit directive/pipe references that are used ([#38539](https://github.com/angular/angular/issues/38539)) ([077f516](https://github.com/angular/angular/commit/077f516))
|
||||||
|
* **compiler-cli:** optimize computation of type-check scope information ([#38539](https://github.com/angular/angular/issues/38539)) ([297c060](https://github.com/angular/angular/commit/297c060))
|
||||||
|
* **router:** use `ngDevMode` to tree-shake error messages in router ([#38674](https://github.com/angular/angular/issues/38674)) ([db21c4f](https://github.com/angular/angular/commit/db21c4f))
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **router:** This change corrects the argument order when calling
|
||||||
|
RouteReuseStrategy#shouldReuseRoute. Previously, when evaluating child
|
||||||
|
routes, they would be called with the future and current arguments would
|
||||||
|
be swapped. If your RouteReuseStrategy relies specifically on only the future
|
||||||
|
or current snapshot state, you may need to update the shouldReuseRoute
|
||||||
|
implementation's use of "future" and "current" ActivateRouteSnapshots.
|
||||||
|
* **common:** The locale data API has been marked as returning readonly arrays, rather
|
||||||
|
than mutable arrays, since these arrays are shared across calls to the
|
||||||
|
API. If you were mutating them (e.g. calling `sort()`, `push()`, `splice()`, etc)
|
||||||
|
then your code will not longer compile. If you need to mutate the array, you
|
||||||
|
should now take a copy (e.g. by calling `slice()`) and mutate the copy.
|
||||||
|
* **common:** When passing a date-time formatted string to the `DatePipe` in a format that contains
|
||||||
|
fractions of a millisecond, the milliseconds will now always be rounded down rather than
|
||||||
|
to the nearest millisecond.
|
||||||
|
|
||||||
|
Most applications will not be affected by this change. If this is not the desired behaviour
|
||||||
|
then consider pre-processing the string to round the millisecond part before passing
|
||||||
|
it to the `DatePipe`.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="10.1.2"></a>
|
||||||
|
## 10.1.2 (2020-09-16)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **compiler:** detect pipes in ICUs in template binder ([#38810](https://github.com/angular/angular/issues/38810)) ([ec2dbe7](https://github.com/angular/angular/commit/ec2dbe7)), closes [#38539](https://github.com/angular/angular/issues/38539) [#38539](https://github.com/angular/angular/issues/38539) [#38539](https://github.com/angular/angular/issues/38539)
|
||||||
|
* **core:** clear the `RefreshTransplantedView` when detached ([#38768](https://github.com/angular/angular/issues/38768)) ([edb7f90](https://github.com/angular/angular/commit/edb7f90)), closes [#38619](https://github.com/angular/angular/issues/38619)
|
||||||
|
* **localize:** ensure that `formatOptions` is optional ([#38787](https://github.com/angular/angular/issues/38787)) ([a47383d](https://github.com/angular/angular/commit/a47383d))
|
||||||
|
* **router:** Ensure routes are processed in priority order and only if needed ([#38780](https://github.com/angular/angular/issues/38780)) ([9c51ba3](https://github.com/angular/angular/commit/9c51ba3)), closes [#38691](https://github.com/angular/angular/issues/38691)
|
||||||
|
* **upgrade:** add try/catch when downgrading injectables ([#38671](https://github.com/angular/angular/issues/38671)) ([5de2ac3](https://github.com/angular/angular/commit/5de2ac3)), closes [#37579](https://github.com/angular/angular/issues/37579)
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **compiler-cli:** only emit directive/pipe references that are used ([#38843](https://github.com/angular/angular/issues/38843)) ([5658405](https://github.com/angular/angular/commit/5658405))
|
||||||
|
* **compiler-cli:** optimize computation of type-check scope information ([#38843](https://github.com/angular/angular/issues/38843)) ([ebede67](https://github.com/angular/angular/commit/ebede67))
|
||||||
|
* **ngcc:** introduce cache for sharing data across entry-points ([#38840](https://github.com/angular/angular/issues/38840)) ([58411e7](https://github.com/angular/angular/commit/58411e7))
|
||||||
|
* **ngcc:** reduce maximum worker count ([#38840](https://github.com/angular/angular/issues/38840)) ([ea36466](https://github.com/angular/angular/commit/ea36466))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="11.0.0-next.1"></a>
|
||||||
|
# 11.0.0-next.1 (2020-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **compiler-cli:** compute source-mappings for localized strings ([#38645](https://github.com/angular/angular/issues/38645)) ([7e0b3fd](https://github.com/angular/angular/commit/7e0b3fd)), closes [#38588](https://github.com/angular/angular/issues/38588)
|
||||||
|
* **core:** remove CollectionChangeRecord symbol ([#38668](https://github.com/angular/angular/issues/38668)) ([fdea180](https://github.com/angular/angular/commit/fdea180))
|
||||||
|
* **router:** support lazy loading for empty path named outlets ([#38379](https://github.com/angular/angular/issues/38379)) ([926ffcd](https://github.com/angular/angular/commit/926ffcd)), closes [#12842](https://github.com/angular/angular/issues/12842)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **core:** CollectionChangeRecord has been removed, use IterableChangeRecord
|
||||||
|
instead
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="10.1.1"></a>
|
||||||
|
## 10.1.1 (2020-09-09)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **compiler:** correct confusion between field and property names ([#38685](https://github.com/angular/angular/issues/38685)) ([a1c34c6](https://github.com/angular/angular/commit/a1c34c6))
|
||||||
|
* **compiler-cli:** compute source-mappings for localized strings ([#38747](https://github.com/angular/angular/issues/38747)) ([b4eb016](https://github.com/angular/angular/commit/b4eb016)), closes [#38588](https://github.com/angular/angular/issues/38588)
|
||||||
|
* **compiler-cli:** ensure that a declaration is available in type-to-value conversion ([#38684](https://github.com/angular/angular/issues/38684)) ([56d5ff2](https://github.com/angular/angular/commit/56d5ff2)), closes [#38670](https://github.com/angular/angular/issues/38670)
|
||||||
|
* **core:** reset `tView` between tests in Ivy TestBed ([#38659](https://github.com/angular/angular/issues/38659)) ([efc7606](https://github.com/angular/angular/commit/efc7606)), closes [#38600](https://github.com/angular/angular/issues/38600)
|
||||||
|
* **localize:** do not expose NodeJS typings in $localize runtime code ([#38700](https://github.com/angular/angular/issues/38700)) ([4de8dc3](https://github.com/angular/angular/commit/4de8dc3)), closes [#38692](https://github.com/angular/angular/issues/38692)
|
||||||
|
* **localize:** enable whitespace preservation marker in XLIFF files ([#38737](https://github.com/angular/angular/issues/38737)) ([190dca0](https://github.com/angular/angular/commit/190dca0)), closes [#38679](https://github.com/angular/angular/issues/38679)
|
||||||
|
* **localize:** install `[@angular](https://github.com/angular)/localize` in `devDependencies` by default ([#38680](https://github.com/angular/angular/issues/38680)) ([dbab744](https://github.com/angular/angular/commit/dbab744)), closes [#38329](https://github.com/angular/angular/issues/38329)
|
||||||
|
* **localize:** render context of translation file parse errors ([#38673](https://github.com/angular/angular/issues/38673)) ([32f33f0](https://github.com/angular/angular/commit/32f33f0)), closes [#38377](https://github.com/angular/angular/issues/38377)
|
||||||
|
* **localize:** render location in XLIFF 2 even if there is no metadata ([#38713](https://github.com/angular/angular/issues/38713)) ([ab4f953](https://github.com/angular/angular/commit/ab4f953)), closes [#38705](https://github.com/angular/angular/issues/38705)
|
||||||
|
* **ngcc:** use aliased exported types correctly ([#38666](https://github.com/angular/angular/issues/38666)) ([6a28675](https://github.com/angular/angular/commit/6a28675)), closes [#38238](https://github.com/angular/angular/issues/38238)
|
||||||
|
* **router:** If users are using the Alt key when clicking the router links, prioritize browser’s default behavior ([#38375](https://github.com/angular/angular/issues/38375)) ([309709d](https://github.com/angular/angular/commit/309709d))
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
|
||||||
|
* **core:** use `ngDevMode` to tree-shake error messages ([#38612](https://github.com/angular/angular/issues/38612)) ([b084bff](https://github.com/angular/angular/commit/b084bff))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="11.0.0-next.0"></a>
|
||||||
|
# 11.0.0-next.0 (2020-09-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **forms:** ensure to emit `statusChanges` on subsequent value update/validations ([#38354](https://github.com/angular/angular/issues/38354)) ([d9fea85](https://github.com/angular/angular/commit/d9fea85)), closes [#20424](https://github.com/angular/angular/issues/20424) [#14542](https://github.com/angular/angular/issues/14542)
|
||||||
|
* **service-worker:** fix condition to check for a cache-busted request ([#36847](https://github.com/angular/angular/issues/36847)) ([5be4edf](https://github.com/angular/angular/commit/5be4edf))
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **service-worker:** add `UnrecoverableStateError` ([#36847](https://github.com/angular/angular/issues/36847)) ([036a2fa](https://github.com/angular/angular/commit/036a2fa)), closes [#36539](https://github.com/angular/angular/issues/36539)
|
||||||
|
|
||||||
|
|
||||||
|
### BREAKING CHANGES
|
||||||
|
|
||||||
|
* **forms:** Previously if FormControl, FormGroup and FormArray class instances had async validators
|
||||||
|
defined at initialization time, the status change event was not emitted once async validator
|
||||||
|
completed. After this change the status event is emitted into the `statusChanges` observable.
|
||||||
|
If your code relies on the old behavior, you can filter/ignore this additional status change
|
||||||
|
event.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<a name="10.1.0"></a>
|
||||||
|
# 10.1.0 (2020-09-02)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* **bazel:** provide LinkablePackageInfo from ng_module ([#37623](https://github.com/angular/angular/issues/37623)) ([6898eab](https://github.com/angular/angular/commit/6898eab))
|
||||||
|
* **common:** add ReadonlyMap in place of Map in keyValuePipe ([#37311](https://github.com/angular/angular/issues/37311)) ([3373453](https://github.com/angular/angular/commit/3373453)), closes [#37308](https://github.com/angular/angular/issues/37308)
|
||||||
|
* **compiler-cli:** add `SourceFile.getOriginalLocation()` to sourcemaps package ([#32912](https://github.com/angular/angular/issues/32912)) ([6abb8d0](https://github.com/angular/angular/commit/6abb8d0))
|
||||||
|
* **compiler-cli:** Add compiler option to report errors when assigning to restricted input fields ([#38249](https://github.com/angular/angular/issues/38249)) ([71138f6](https://github.com/angular/angular/commit/71138f6))
|
||||||
|
* **compiler-cli:** add support for TypeScript 4.0 ([#38076](https://github.com/angular/angular/issues/38076)) ([0fc44e0](https://github.com/angular/angular/commit/0fc44e0))
|
||||||
|
* **compiler-cli:** explain why an expression cannot be used in AOT compilations ([#37587](https://github.com/angular/angular/issues/37587)) ([712f1bd](https://github.com/angular/angular/commit/712f1bd))
|
||||||
|
* **compiler:** support unary operators for more accurate type checking ([#37918](https://github.com/angular/angular/issues/37918)) ([874792d](https://github.com/angular/angular/commit/874792d)), closes [#20845](https://github.com/angular/angular/issues/20845) [#36178](https://github.com/angular/angular/issues/36178)
|
||||||
|
* **core:** rename async to waitForAsync to avoid confusing ([#37583](https://github.com/angular/angular/issues/37583)) ([8f07429](https://github.com/angular/angular/commit/8f07429))
|
||||||
|
* **core:** support injection token as predicate in queries ([#37506](https://github.com/angular/angular/issues/37506)) ([97dc85b](https://github.com/angular/angular/commit/97dc85b)), closes [#21152](https://github.com/angular/angular/issues/21152) [#36144](https://github.com/angular/angular/issues/36144)
|
||||||
|
* **core:** update reference and doc to change `async` to `waitAsync`. ([#37583](https://github.com/angular/angular/issues/37583)) ([8fbf40b](https://github.com/angular/angular/commit/8fbf40b))
|
||||||
|
* **forms:** AbstractControl to store raw validators in addition to combined validators function ([#37881](https://github.com/angular/angular/issues/37881)) ([ad7046b](https://github.com/angular/angular/commit/ad7046b))
|
||||||
|
* **localize:** allow duplicate messages to be handled during extraction ([#38082](https://github.com/angular/angular/issues/38082)) ([cf9a47b](https://github.com/angular/angular/commit/cf9a47b)), closes [#38077](https://github.com/angular/angular/issues/38077)
|
||||||
|
* **localize:** expose `canParse()` diagnostics ([#37909](https://github.com/angular/angular/issues/37909)) ([ec32eba](https://github.com/angular/angular/commit/ec32eba)), closes [#37901](https://github.com/angular/angular/issues/37901)
|
||||||
|
* **localize:** implement message extraction tool ([#32912](https://github.com/angular/angular/issues/32912)) ([190561d](https://github.com/angular/angular/commit/190561d))
|
||||||
|
* **platform-browser:** Allow `sms`-URLs ([#31463](https://github.com/angular/angular/issues/31463)) ([fc5c34d](https://github.com/angular/angular/commit/fc5c34d)), closes [#31462](https://github.com/angular/angular/issues/31462)
|
||||||
|
* **platform-server:** add option for absolute URL HTTP support ([#37539](https://github.com/angular/angular/issues/37539)) ([d37049a](https://github.com/angular/angular/commit/d37049a)), closes [#37071](https://github.com/angular/angular/issues/37071)
|
||||||
|
* **router:** better warning message when a router outlet has not been instantiated ([#30246](https://github.com/angular/angular/issues/30246)) ([1609815](https://github.com/angular/angular/commit/1609815))
|
||||||
|
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* **bazel:** fix integration test for bazel building ([#38629](https://github.com/angular/angular/issues/38629)) ([dd82f2f](https://github.com/angular/angular/commit/dd82f2f))
|
||||||
|
* **common:** date pipe gives wrong week number ([#37632](https://github.com/angular/angular/issues/37632)) ([ef1fb6d](https://github.com/angular/angular/commit/ef1fb6d)), closes [#33961](https://github.com/angular/angular/issues/33961)
|
||||||
|
* **common:** narrow `NgIf` context variables in template type checker ([#36627](https://github.com/angular/angular/issues/36627)) ([9c8bc4a](https://github.com/angular/angular/commit/9c8bc4a))
|
||||||
|
* **compiler-cli:** avoid creating value expressions for symbols from type-only imports ([#37912](https://github.com/angular/angular/issues/37912)) ([18098d3](https://github.com/angular/angular/commit/18098d3)), closes [#37900](https://github.com/angular/angular/issues/37900)
|
||||||
|
* **compiler-cli:** ensure source-maps can handle webpack:// protocol ([#32912](https://github.com/angular/angular/issues/32912)) ([decd95e](https://github.com/angular/angular/commit/decd95e))
|
||||||
|
* **compiler-cli:** only read source-map comment from last line ([#32912](https://github.com/angular/angular/issues/32912)) ([07a07e3](https://github.com/angular/angular/commit/07a07e3))
|
||||||
|
* **compiler-cli:** type-check inputs that include undefined when there's coercion members ([#38273](https://github.com/angular/angular/issues/38273)) ([7525f3a](https://github.com/angular/angular/commit/7525f3a))
|
||||||
|
* **compiler:** incorrectly inferring namespace for HTML nodes inside SVG ([#38477](https://github.com/angular/angular/issues/38477)) ([0dda97e](https://github.com/angular/angular/commit/0dda97e)), closes [#37218](https://github.com/angular/angular/issues/37218)
|
||||||
|
* **compiler:** mark `NgModuleFactory` construction as not side effectful ([#38147](https://github.com/angular/angular/issues/38147)) ([7f8c222](https://github.com/angular/angular/commit/7f8c222))
|
||||||
|
* **core:** Allow modification of lifecycle hooks any time before bootstrap ([#35464](https://github.com/angular/angular/issues/35464)) ([737506e](https://github.com/angular/angular/commit/737506e)), closes [#30497](https://github.com/angular/angular/issues/30497)
|
||||||
|
* **core:** detect DI parameters in JIT mode for downleveled ES2015 classes ([#38463](https://github.com/angular/angular/issues/38463)) ([ca07da4](https://github.com/angular/angular/commit/ca07da4)), closes [#38453](https://github.com/angular/angular/issues/38453)
|
||||||
|
* **core:** determine required DOMParser feature availability ([#36578](https://github.com/angular/angular/issues/36578)) ([#36578](https://github.com/angular/angular/issues/36578)) ([c509243](https://github.com/angular/angular/commit/c509243))
|
||||||
|
* **core:** do not trigger CSP alert/report in Firefox and Chrome ([#36578](https://github.com/angular/angular/issues/36578)) ([#36578](https://github.com/angular/angular/issues/36578)) ([b950d46](https://github.com/angular/angular/commit/b950d46)), closes [#25214](https://github.com/angular/angular/issues/25214)
|
||||||
|
* **core:** move generated i18n statements to the `consts` field of ComponentDef ([#38404](https://github.com/angular/angular/issues/38404)) ([cb05c01](https://github.com/angular/angular/commit/cb05c01))
|
||||||
|
* **elements:** run strategy methods in correct zone ([#37814](https://github.com/angular/angular/issues/37814)) ([8df888d](https://github.com/angular/angular/commit/8df888d)), closes [#24181](https://github.com/angular/angular/issues/24181)
|
||||||
|
* **forms:** handle form groups/arrays own pending async validation ([#22575](https://github.com/angular/angular/issues/22575)) ([77b62a5](https://github.com/angular/angular/commit/77b62a5)), closes [#10064](https://github.com/angular/angular/issues/10064)
|
||||||
|
* **language-service:** non-existent module format in package output ([#37623](https://github.com/angular/angular/issues/37623)) ([413a0fb](https://github.com/angular/angular/commit/413a0fb))
|
||||||
* **localize:** ensure required XLIFF parameters are serialized ([#38575](https://github.com/angular/angular/issues/38575)) ([f0af387](https://github.com/angular/angular/commit/f0af387)), closes [#38570](https://github.com/angular/angular/issues/38570)
|
* **localize:** ensure required XLIFF parameters are serialized ([#38575](https://github.com/angular/angular/issues/38575)) ([f0af387](https://github.com/angular/angular/commit/f0af387)), closes [#38570](https://github.com/angular/angular/issues/38570)
|
||||||
|
* **localize:** extract the correct message ids ([#38498](https://github.com/angular/angular/issues/38498)) ([ac461e1](https://github.com/angular/angular/commit/ac461e1))
|
||||||
|
* **localize:** render ICU placeholders in extracted translation files ([#38484](https://github.com/angular/angular/issues/38484)) ([81c3e80](https://github.com/angular/angular/commit/81c3e80))
|
||||||
* **localize:** render text of extracted placeholders ([#38536](https://github.com/angular/angular/issues/38536)) ([14e90be](https://github.com/angular/angular/commit/14e90be))
|
* **localize:** render text of extracted placeholders ([#38536](https://github.com/angular/angular/issues/38536)) ([14e90be](https://github.com/angular/angular/commit/14e90be))
|
||||||
|
* **ngcc:** detect synthesized delegate constructors for downleveled ES2015 classes ([#38463](https://github.com/angular/angular/issues/38463)) ([3b9c802](https://github.com/angular/angular/commit/3b9c802)), closes [#38453](https://github.com/angular/angular/issues/38453) [#38453](https://github.com/angular/angular/issues/38453)
|
||||||
|
* **router:** defer loading of wildcard module until needed ([#38348](https://github.com/angular/angular/issues/38348)) ([8f708b5](https://github.com/angular/angular/commit/8f708b5)), closes [#25494](https://github.com/angular/angular/issues/25494)
|
||||||
|
* **router:** fix navigation ignoring logic to compare to the browser url ([#37716](https://github.com/angular/angular/issues/37716)) ([a5ffca0](https://github.com/angular/angular/commit/a5ffca0)), closes [#16710](https://github.com/angular/angular/issues/16710) [#13586](https://github.com/angular/angular/issues/13586)
|
||||||
|
* **router:** properly compare array queryParams for equality ([#37709](https://github.com/angular/angular/issues/37709)) ([#37860](https://github.com/angular/angular/issues/37860)) ([1801d0c](https://github.com/angular/angular/commit/1801d0c))
|
||||||
|
* **router:** remove parenthesis for primary outlet segment after removing auxiliary outlet segment ([#24656](https://github.com/angular/angular/issues/24656)) ([#37163](https://github.com/angular/angular/issues/37163)) ([71f008f](https://github.com/angular/angular/commit/71f008f))
|
||||||
|
* **router:** restore 'history.state' object for navigations coming from Angular router ([#28108](https://github.com/angular/angular/issues/28108)) ([#28176](https://github.com/angular/angular/issues/28176)) ([df76a20](https://github.com/angular/angular/commit/df76a20))
|
||||||
|
|
||||||
|
### Code Refactoring
|
||||||
|
* **router:** export DefaultRouteReuseStrategy to Router public_api ([#31575](https://github.com/angular/angular/issues/31575)) ([ca79880](https://github.com/angular/angular/commit/ca79880))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Performance Improvements
|
||||||
|
* **compiler-cli:** don't emit template guards when child scope is empty ([#38418](https://github.com/angular/angular/issues/38418)) ([1388c17](https://github.com/angular/angular/commit/1388c17))
|
||||||
|
* **compiler-cli:** fix regressions in incremental program reuse ([#37641](https://github.com/angular/angular/issues/37641)) ([5103d90](https://github.com/angular/angular/commit/5103d90))
|
||||||
|
* **compiler-cli:** only generate directive declarations when used ([#38418](https://github.com/angular/angular/issues/38418)) ([fb8f4b4](https://github.com/angular/angular/commit/fb8f4b4))
|
||||||
|
* **compiler-cli:** only generate type-check code for referenced DOM elements ([#38418](https://github.com/angular/angular/issues/38418)) ([f42e6ce](https://github.com/angular/angular/commit/f42e6ce))
|
||||||
|
* **forms:** use internal `ngDevMode` flag to tree-shake error messages in prod builds ([#37821](https://github.com/angular/angular/issues/37821)) ([201a546](https://github.com/angular/angular/commit/201a546)), closes [#37697](https://github.com/angular/angular/issues/37697)
|
||||||
|
* **ngcc:** shortcircuit tokenizing in ESM dependency host ([#37639](https://github.com/angular/angular/issues/37639)) ([bd7f440](https://github.com/angular/angular/commit/bd7f440))
|
||||||
|
* **ngcc:** use `EntryPointManifest` to speed up noop `ProgramBaseEntryPointFinder` ([#37665](https://github.com/angular/angular/issues/37665)) ([9318e23](https://github.com/angular/angular/commit/9318e23))
|
||||||
|
* **router:** apply prioritizedGuardValue operator to optimize CanLoad guards ([#37523](https://github.com/angular/angular/issues/37523)) ([d7dd295](https://github.com/angular/angular/commit/d7dd295))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -13,29 +360,6 @@
|
|||||||
## 10.0.14 (2020-08-26)
|
## 10.0.14 (2020-08-26)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.8"></a>
|
|
||||||
# 10.1.0-next.8 (2020-08-24)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **localize:** extract the correct message ids ([#38498](https://github.com/angular/angular/issues/38498)) ([ac461e1](https://github.com/angular/angular/commit/ac461e1))
|
|
||||||
* **router:** support lazy loading for empty path named outlets ([#38379](https://github.com/angular/angular/issues/38379)) ([7ad3264](https://github.com/angular/angular/commit/7ad3264)), closes [#12842](https://github.com/angular/angular/issues/12842)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **compiler:** support unary operators for more accurate type checking ([#37918](https://github.com/angular/angular/issues/37918)) ([874792d](https://github.com/angular/angular/commit/874792d)), closes [#20845](https://github.com/angular/angular/issues/20845) [#36178](https://github.com/angular/angular/issues/36178)
|
|
||||||
* **compiler-cli:** add support for TypeScript 4.0 ([#38076](https://github.com/angular/angular/issues/38076)) ([0fc44e0](https://github.com/angular/angular/commit/0fc44e0))
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* **forms:** use internal `ngDevMode` flag to tree-shake error messages in prod builds ([#37821](https://github.com/angular/angular/issues/37821)) ([201a546](https://github.com/angular/angular/commit/201a546)), closes [#37697](https://github.com/angular/angular/issues/37697)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.12"></a>
|
<a name="10.0.12"></a>
|
||||||
## 10.0.12 (2020-08-24)
|
## 10.0.12 (2020-08-24)
|
||||||
|
|
||||||
@ -53,13 +377,6 @@
|
|||||||
* **language-service:** introduce hybrid visitor to locate AST node ([#38540](https://github.com/angular/angular/issues/38540)) ([66d8c22](https://github.com/angular/angular/commit/66d8c22))
|
* **language-service:** introduce hybrid visitor to locate AST node ([#38540](https://github.com/angular/angular/issues/38540)) ([66d8c22](https://github.com/angular/angular/commit/66d8c22))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.7"></a>
|
|
||||||
# 10.1.0-next.7 (2020-08-19)
|
|
||||||
|
|
||||||
This release contains various API docs improvements.
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.11"></a>
|
<a name="10.0.11"></a>
|
||||||
## 10.0.11 (2020-08-19)
|
## 10.0.11 (2020-08-19)
|
||||||
|
|
||||||
@ -70,29 +387,6 @@ This release contains various API docs improvements.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.6"></a>
|
|
||||||
# 10.1.0-next.6 (2020-08-17)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **core:** detect DI parameters in JIT mode for downleveled ES2015 classes ([#38463](https://github.com/angular/angular/issues/38463)) ([ca07da4](https://github.com/angular/angular/commit/ca07da4)), closes [#38453](https://github.com/angular/angular/issues/38453)
|
|
||||||
* **core:** move generated i18n statements to the `consts` field of ComponentDef ([#38404](https://github.com/angular/angular/issues/38404)) ([cb05c01](https://github.com/angular/angular/commit/cb05c01))
|
|
||||||
* **localize:** render ICU placeholders in extracted translation files ([#38484](https://github.com/angular/angular/issues/38484)) ([81c3e80](https://github.com/angular/angular/commit/81c3e80))
|
|
||||||
* **ngcc:** detect synthesized delegate constructors for downleveled ES2015 classes ([#38463](https://github.com/angular/angular/issues/38463)) ([3b9c802](https://github.com/angular/angular/commit/3b9c802)), closes [#38453](https://github.com/angular/angular/issues/38453) [#38453](https://github.com/angular/angular/issues/38453)
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* **compiler-cli:** don't emit template guards when child scope is empty ([#38418](https://github.com/angular/angular/issues/38418)) ([1388c17](https://github.com/angular/angular/commit/1388c17))
|
|
||||||
* **compiler-cli:** only generate directive declarations when used ([#38418](https://github.com/angular/angular/issues/38418)) ([fb8f4b4](https://github.com/angular/angular/commit/fb8f4b4))
|
|
||||||
* **compiler-cli:** only generate type-check code for referenced DOM elements ([#38418](https://github.com/angular/angular/issues/38418)) ([f42e6ce](https://github.com/angular/angular/commit/f42e6ce))
|
|
||||||
|
|
||||||
### Code Refactoring
|
|
||||||
* **router:** export DefaultRouteReuseStrategy to Router public_api ([#31575](https://github.com/angular/angular/issues/31575)) ([ca79880](https://github.com/angular/angular/commit/ca79880))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.10"></a>
|
<a name="10.0.10"></a>
|
||||||
## 10.0.10 (2020-08-17)
|
## 10.0.10 (2020-08-17)
|
||||||
|
|
||||||
@ -108,25 +402,6 @@ This release contains various API docs improvements.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.5"></a>
|
|
||||||
# 10.1.0-next.5 (2020-08-12)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **compiler-cli:** avoid creating value expressions for symbols from type-only imports ([#37912](https://github.com/angular/angular/issues/37912)) ([18098d3](https://github.com/angular/angular/commit/18098d3)), closes [#37900](https://github.com/angular/angular/issues/37900)
|
|
||||||
* **compiler-cli:** type-check inputs that include undefined when there's coercion members ([#38273](https://github.com/angular/angular/issues/38273)) ([7525f3a](https://github.com/angular/angular/commit/7525f3a))
|
|
||||||
* **router:** defer loading of wildcard module until needed ([#38348](https://github.com/angular/angular/issues/38348)) ([8f708b5](https://github.com/angular/angular/commit/8f708b5)), closes [#25494](https://github.com/angular/angular/issues/25494)
|
|
||||||
* **router:** restore 'history.state' object for navigations coming from Angular router ([#28108](https://github.com/angular/angular/issues/28108)) ([#28176](https://github.com/angular/angular/issues/28176)) ([df76a20](https://github.com/angular/angular/commit/df76a20))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **compiler-cli:** Add compiler option to report errors when assigning to restricted input fields ([#38249](https://github.com/angular/angular/issues/38249)) ([71138f6](https://github.com/angular/angular/commit/71138f6))
|
|
||||||
* **router:** better warning message when a router outlet has not been instantiated ([#30246](https://github.com/angular/angular/issues/30246)) ([1609815](https://github.com/angular/angular/commit/1609815))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.9"></a>
|
<a name="10.0.9"></a>
|
||||||
## 10.0.9 (2020-08-12)
|
## 10.0.9 (2020-08-12)
|
||||||
|
|
||||||
@ -148,24 +423,6 @@ This release contains various API docs improvements.
|
|||||||
* **service-worker:** fix the chrome debugger syntax highlighter ([#38332](https://github.com/angular/angular/issues/38332)) ([f5d5bac](https://github.com/angular/angular/commit/f5d5bac))
|
* **service-worker:** fix the chrome debugger syntax highlighter ([#38332](https://github.com/angular/angular/issues/38332)) ([f5d5bac](https://github.com/angular/angular/commit/f5d5bac))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.4"></a>
|
|
||||||
# 10.1.0-next.4 (2020-08-04)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **common:** narrow `NgIf` context variables in template type checker ([#36627](https://github.com/angular/angular/issues/36627)) ([9c8bc4a](https://github.com/angular/angular/commit/9c8bc4a))
|
|
||||||
* **compiler:** mark `NgModuleFactory` construction as not side effectful ([#38147](https://github.com/angular/angular/issues/38147)) ([7f8c222](https://github.com/angular/angular/commit/7f8c222))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **core:** rename async to waitForAsync to avoid confusing ([#37583](https://github.com/angular/angular/issues/37583)) ([8f07429](https://github.com/angular/angular/commit/8f07429))
|
|
||||||
* **core:** update reference and doc to change `async` to `waitAsync`. ([#37583](https://github.com/angular/angular/issues/37583)) ([8fbf40b](https://github.com/angular/angular/commit/8fbf40b))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.8"></a>
|
<a name="10.0.8"></a>
|
||||||
## 10.0.8 (2020-08-04)
|
## 10.0.8 (2020-08-04)
|
||||||
|
|
||||||
@ -187,16 +444,6 @@ This release contains various API docs improvements.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.3"></a>
|
|
||||||
# 10.1.0-next.3 (2020-07-28)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **elements:** run strategy methods in correct zone ([#37814](https://github.com/angular/angular/issues/37814)) ([8df888d](https://github.com/angular/angular/commit/8df888d)), closes [#24181](https://github.com/angular/angular/issues/24181)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.6"></a>
|
<a name="10.0.6"></a>
|
||||||
## 10.0.6 (2020-07-28)
|
## 10.0.6 (2020-07-28)
|
||||||
|
|
||||||
@ -210,23 +457,6 @@ This release contains various API docs improvements.
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.2"></a>
|
|
||||||
# 10.1.0-next.2 (2020-07-22)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **core:** Allow modification of lifecycle hooks any time before bootstrap ([#35464](https://github.com/angular/angular/issues/35464)) ([737506e](https://github.com/angular/angular/commit/737506e)), closes [#30497](https://github.com/angular/angular/issues/30497)
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **common:** add ReadonlyMap in place of Map in keyValuePipe ([#37311](https://github.com/angular/angular/issues/37311)) ([3373453](https://github.com/angular/angular/commit/3373453)), closes [#37308](https://github.com/angular/angular/issues/37308)
|
|
||||||
* **forms:** AbstractControl to store raw validators in addition to combined validators function ([#37881](https://github.com/angular/angular/issues/37881)) ([ad7046b](https://github.com/angular/angular/commit/ad7046b))
|
|
||||||
* **localize:** allow duplicate messages to be handled during extraction ([#38082](https://github.com/angular/angular/issues/38082)) ([cf9a47b](https://github.com/angular/angular/commit/cf9a47b)), closes [#38077](https://github.com/angular/angular/issues/38077)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.5"></a>
|
<a name="10.0.5"></a>
|
||||||
## 10.0.5 (2020-07-22)
|
## 10.0.5 (2020-07-22)
|
||||||
|
|
||||||
@ -261,62 +491,6 @@ This release contains various API docs improvements.
|
|||||||
* **bazel:** provide LinkablePackageInfo from ng_module ([#37778](https://github.com/angular/angular/issues/37778)) ([6cd10a1](https://github.com/angular/angular/commit/6cd10a1)), closes [/github.com/bazelbuild/rules_nodejs/blob/9a5de3728b05bf1647bbb87ad99f54e626604705/internal/linker/link_node_modules.bzl#L144-L146](https://github.com//github.com/bazelbuild/rules_nodejs/blob/9a5de3728b05bf1647bbb87ad99f54e626604705/internal/linker/link_node_modules.bzl/issues/L144-L146)
|
* **bazel:** provide LinkablePackageInfo from ng_module ([#37778](https://github.com/angular/angular/issues/37778)) ([6cd10a1](https://github.com/angular/angular/commit/6cd10a1)), closes [/github.com/bazelbuild/rules_nodejs/blob/9a5de3728b05bf1647bbb87ad99f54e626604705/internal/linker/link_node_modules.bzl#L144-L146](https://github.com//github.com/bazelbuild/rules_nodejs/blob/9a5de3728b05bf1647bbb87ad99f54e626604705/internal/linker/link_node_modules.bzl/issues/L144-L146)
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.1"></a>
|
|
||||||
# 10.1.0-next.1 (2020-07-15)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **bazel:** ng_module rule does not expose flat module information in Ivy ([#36971](https://github.com/angular/angular/issues/36971)) ([1550663](https://github.com/angular/angular/commit/1550663))
|
|
||||||
* **compiler:** check more cases for pipe usage inside host bindings ([#37883](https://github.com/angular/angular/issues/37883)) ([9322b9a](https://github.com/angular/angular/commit/9322b9a)), closes [#34655](https://github.com/angular/angular/issues/34655) [#37610](https://github.com/angular/angular/issues/37610)
|
|
||||||
* **compiler-cli:** ensure file_system handles mixed Windows drives ([#37959](https://github.com/angular/angular/issues/37959)) ([6b31155](https://github.com/angular/angular/commit/6b31155)), closes [#36777](https://github.com/angular/angular/issues/36777)
|
|
||||||
* **language-service:** remove completion for string ([#37983](https://github.com/angular/angular/issues/37983)) ([10aba15](https://github.com/angular/angular/commit/10aba15))
|
|
||||||
* **ngcc:** report a warning if ngcc tries to use a solution-style tsconfig ([#38003](https://github.com/angular/angular/issues/38003)) ([b358495](https://github.com/angular/angular/commit/b358495)), closes [#36386](https://github.com/angular/angular/issues/36386)
|
|
||||||
* **router:** ensure duplicate popstate/hashchange events are handled correctly ([#37674](https://github.com/angular/angular/issues/37674)) ([9185c6e](https://github.com/angular/angular/commit/9185c6e)), closes [/github.com/angular/angular/issues/16710#issuecomment-646919529](https://github.com//github.com/angular/angular/issues/16710/issues/issuecomment-646919529) [#16710](https://github.com/angular/angular/issues/16710)
|
|
||||||
* **service-worker:** correctly handle relative base href ([#37922](https://github.com/angular/angular/issues/37922)) ([d19ef65](https://github.com/angular/angular/commit/d19ef65)), closes [#25055](https://github.com/angular/angular/issues/25055) [#25055](https://github.com/angular/angular/issues/25055)
|
|
||||||
* **service-worker:** correctly serve `ngsw/state` with a non-root SW scope ([#37922](https://github.com/angular/angular/issues/37922)) ([2156bee](https://github.com/angular/angular/commit/2156bee)), closes [#30505](https://github.com/angular/angular/issues/30505)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.1.0-next.0"></a>
|
|
||||||
# 10.1.0-next.0 (2020-07-08)
|
|
||||||
|
|
||||||
|
|
||||||
### Bug Fixes
|
|
||||||
|
|
||||||
* **common:** date pipe gives wrong week number ([#37632](https://github.com/angular/angular/issues/37632)) ([ef1fb6d](https://github.com/angular/angular/commit/ef1fb6d)), closes [#33961](https://github.com/angular/angular/issues/33961)
|
|
||||||
* **compiler-cli:** ensure source-maps can handle webpack:// protocol ([#32912](https://github.com/angular/angular/issues/32912)) ([decd95e](https://github.com/angular/angular/commit/decd95e))
|
|
||||||
* **compiler-cli:** only read source-map comment from last line ([#32912](https://github.com/angular/angular/issues/32912)) ([07a07e3](https://github.com/angular/angular/commit/07a07e3))
|
|
||||||
* **core:** determine required DOMParser feature availability ([#36578](https://github.com/angular/angular/issues/36578)) ([#36578](https://github.com/angular/angular/issues/36578)) ([c509243](https://github.com/angular/angular/commit/c509243))
|
|
||||||
* **core:** do not trigger CSP alert/report in Firefox and Chrome ([#36578](https://github.com/angular/angular/issues/36578)) ([#36578](https://github.com/angular/angular/issues/36578)) ([b950d46](https://github.com/angular/angular/commit/b950d46)), closes [#25214](https://github.com/angular/angular/issues/25214)
|
|
||||||
* **forms:** handle form groups/arrays own pending async validation ([#22575](https://github.com/angular/angular/issues/22575)) ([77b62a5](https://github.com/angular/angular/commit/77b62a5)), closes [#10064](https://github.com/angular/angular/issues/10064)
|
|
||||||
* **language-service:** non-existent module format in package output ([#37623](https://github.com/angular/angular/issues/37623)) ([413a0fb](https://github.com/angular/angular/commit/413a0fb))
|
|
||||||
* **router:** fix navigation ignoring logic to compare to the browser url ([#37716](https://github.com/angular/angular/issues/37716)) ([a5ffca0](https://github.com/angular/angular/commit/a5ffca0)), closes [#16710](https://github.com/angular/angular/issues/16710) [#13586](https://github.com/angular/angular/issues/13586)
|
|
||||||
* **router:** properly compare array queryParams for equality ([#37709](https://github.com/angular/angular/issues/37709)) ([#37860](https://github.com/angular/angular/issues/37860)) ([1801d0c](https://github.com/angular/angular/commit/1801d0c))
|
|
||||||
* **router:** remove parenthesis for primary outlet segment after removing auxiliary outlet segment ([#24656](https://github.com/angular/angular/issues/24656)) ([#37163](https://github.com/angular/angular/issues/37163)) ([71f008f](https://github.com/angular/angular/commit/71f008f))
|
|
||||||
|
|
||||||
|
|
||||||
### Features
|
|
||||||
|
|
||||||
* **bazel:** provide LinkablePackageInfo from ng_module ([#37623](https://github.com/angular/angular/issues/37623)) ([6898eab](https://github.com/angular/angular/commit/6898eab))
|
|
||||||
* **compiler-cli:** add `SourceFile.getOriginalLocation()` to sourcemaps package ([#32912](https://github.com/angular/angular/issues/32912)) ([6abb8d0](https://github.com/angular/angular/commit/6abb8d0))
|
|
||||||
* **compiler-cli:** explain why an expression cannot be used in AOT compilations ([#37587](https://github.com/angular/angular/issues/37587)) ([712f1bd](https://github.com/angular/angular/commit/712f1bd))
|
|
||||||
* **core:** support injection token as predicate in queries ([#37506](https://github.com/angular/angular/issues/37506)) ([97dc85b](https://github.com/angular/angular/commit/97dc85b)), closes [#21152](https://github.com/angular/angular/issues/21152) [#36144](https://github.com/angular/angular/issues/36144)
|
|
||||||
* **localize:** expose `canParse()` diagnostics ([#37909](https://github.com/angular/angular/issues/37909)) ([ec32eba](https://github.com/angular/angular/commit/ec32eba)), closes [#37901](https://github.com/angular/angular/issues/37901)
|
|
||||||
* **localize:** implement message extraction tool ([#32912](https://github.com/angular/angular/issues/32912)) ([190561d](https://github.com/angular/angular/commit/190561d))
|
|
||||||
* **platform-browser:** Allow `sms`-URLs ([#31463](https://github.com/angular/angular/issues/31463)) ([fc5c34d](https://github.com/angular/angular/commit/fc5c34d)), closes [#31462](https://github.com/angular/angular/issues/31462)
|
|
||||||
* **platform-server:** add option for absolute URL HTTP support ([#37539](https://github.com/angular/angular/issues/37539)) ([d37049a](https://github.com/angular/angular/commit/d37049a)), closes [#37071](https://github.com/angular/angular/issues/37071)
|
|
||||||
|
|
||||||
|
|
||||||
### Performance Improvements
|
|
||||||
|
|
||||||
* **compiler-cli:** fix regressions in incremental program reuse ([#37641](https://github.com/angular/angular/issues/37641)) ([5103d90](https://github.com/angular/angular/commit/5103d90))
|
|
||||||
* **ngcc:** shortcircuit tokenizing in ESM dependency host ([#37639](https://github.com/angular/angular/issues/37639)) ([bd7f440](https://github.com/angular/angular/commit/bd7f440))
|
|
||||||
* **ngcc:** use `EntryPointManifest` to speed up noop `ProgramBaseEntryPointFinder` ([#37665](https://github.com/angular/angular/issues/37665)) ([9318e23](https://github.com/angular/angular/commit/9318e23))
|
|
||||||
* **router:** apply prioritizedGuardValue operator to optimize CanLoad guards ([#37523](https://github.com/angular/angular/issues/37523)) ([d7dd295](https://github.com/angular/angular/commit/d7dd295))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<a name="10.0.3"></a>
|
<a name="10.0.3"></a>
|
||||||
## 10.0.3 (2020-07-08)
|
## 10.0.3 (2020-07-08)
|
||||||
|
|
||||||
|
@ -209,9 +209,9 @@ Any line of the commit message cannot be longer than 100 characters.
|
|||||||
│ │
|
│ │
|
||||||
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
|
│ └─⫸ Commit Scope: animations|bazel|benchpress|common|compiler|compiler-cli|core|
|
||||||
│ elements|forms|http|language-service|localize|platform-browser|
|
│ elements|forms|http|language-service|localize|platform-browser|
|
||||||
│ platform-browser-dynamic|platform-server|platform-webworker|
|
│ platform-browser-dynamic|platform-server|router|service-worker|
|
||||||
│ platform-webworker-dynamic|router|service-worker|upgrade|zone.js|
|
│ upgrade|zone.js|packaging|changelog|dev-infra|docs-infra|migrations|
|
||||||
│ packaging|changelog|dev-infra|docs-infra|migrations|ngcc|ve
|
│ ngcc|ve
|
||||||
│
|
│
|
||||||
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
|
└─⫸ Commit Type: build|ci|docs|feat|fix|perf|refactor|style|test
|
||||||
```
|
```
|
||||||
@ -230,7 +230,6 @@ Must be one of the following:
|
|||||||
* **fix**: A bug fix
|
* **fix**: A bug fix
|
||||||
* **perf**: A code change that improves performance
|
* **perf**: A code change that improves performance
|
||||||
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
* **refactor**: A code change that neither fixes a bug nor adds a feature
|
||||||
* **style**: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
|
|
||||||
* **test**: Adding missing tests or correcting existing tests
|
* **test**: Adding missing tests or correcting existing tests
|
||||||
|
|
||||||
|
|
||||||
@ -254,8 +253,6 @@ The following is the list of supported scopes:
|
|||||||
* `platform-browser`
|
* `platform-browser`
|
||||||
* `platform-browser-dynamic`
|
* `platform-browser-dynamic`
|
||||||
* `platform-server`
|
* `platform-server`
|
||||||
* `platform-webworker`
|
|
||||||
* `platform-webworker-dynamic`
|
|
||||||
* `router`
|
* `router`
|
||||||
* `service-worker`
|
* `service-worker`
|
||||||
* `upgrade`
|
* `upgrade`
|
||||||
|
@ -6,6 +6,7 @@ Everything in this folder is part of the documentation project. This includes
|
|||||||
* the dgeni configuration for converting source files to rendered files that can be viewed in the web site.
|
* the dgeni configuration for converting source files to rendered files that can be viewed in the web site.
|
||||||
* the tooling for setting up examples for development; and generating live-example and zip files from the examples.
|
* the tooling for setting up examples for development; and generating live-example and zip files from the examples.
|
||||||
|
|
||||||
|
<a name="developer-tasks"></a>
|
||||||
## Developer tasks
|
## Developer tasks
|
||||||
|
|
||||||
We use [Yarn](https://yarnpkg.com) to manage the dependencies and to run build tasks.
|
We use [Yarn](https://yarnpkg.com) to manage the dependencies and to run build tasks.
|
||||||
|
@ -16,13 +16,6 @@ import {BuildNums, PrNums, SHA} from './constants';
|
|||||||
|
|
||||||
const logger = new Logger('mock-external-apis');
|
const logger = new Logger('mock-external-apis');
|
||||||
|
|
||||||
const log = (...args: any[]) => {
|
|
||||||
// Filter out non-matching URL checks
|
|
||||||
if (!/^matching.+: false$/.test(args[0])) {
|
|
||||||
logger.log(...args);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const AIO_CIRCLE_CI_TOKEN = getEnvVar('AIO_CIRCLE_CI_TOKEN');
|
const AIO_CIRCLE_CI_TOKEN = getEnvVar('AIO_CIRCLE_CI_TOKEN');
|
||||||
const AIO_GITHUB_TOKEN = getEnvVar('AIO_GITHUB_TOKEN');
|
const AIO_GITHUB_TOKEN = getEnvVar('AIO_GITHUB_TOKEN');
|
||||||
|
|
||||||
@ -91,8 +84,8 @@ const createArchive = (buildNum: number, prNum: number, sha: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Create request scopes
|
// Create request scopes
|
||||||
const circleCiApi = nock(CIRCLE_CI_API_HOST).log(log).persist();
|
const circleCiApi = nock(CIRCLE_CI_API_HOST).persist();
|
||||||
const githubApi = nock(GITHUB_API_HOST).log(log).persist().matchHeader('Authorization', `token ${AIO_GITHUB_TOKEN}`);
|
const githubApi = nock(GITHUB_API_HOST).persist().matchHeader('Authorization', `token ${AIO_GITHUB_TOKEN}`);
|
||||||
|
|
||||||
//////////////////////////////
|
//////////////////////////////
|
||||||
|
|
||||||
|
@ -27,28 +27,28 @@
|
|||||||
"body-parser": "^1.19.0",
|
"body-parser": "^1.19.0",
|
||||||
"delete-empty": "^3.0.0",
|
"delete-empty": "^3.0.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"jasmine": "^3.5.0",
|
"jasmine": "^3.6.1",
|
||||||
"nock": "^12.0.3",
|
"nock": "^13.0.4",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.1",
|
||||||
"shelljs": "^0.8.4",
|
"shelljs": "^0.8.4",
|
||||||
"source-map-support": "^0.5.19",
|
"source-map-support": "^0.5.19",
|
||||||
"tar-stream": "^2.1.2",
|
"tar-stream": "^2.1.3",
|
||||||
"tslib": "^1.11.1"
|
"tslib": "^2.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@types/body-parser": "^1.19.0",
|
"@types/body-parser": "^1.19.0",
|
||||||
"@types/express": "^4.17.6",
|
"@types/express": "^4.17.8",
|
||||||
"@types/jasmine": "^3.5.10",
|
"@types/jasmine": "^3.5.14",
|
||||||
"@types/nock": "^11.1.0",
|
"@types/nock": "^11.1.0",
|
||||||
"@types/node": "^13.13.2",
|
"@types/node": "^14.6.4",
|
||||||
"@types/node-fetch": "^2.5.7",
|
"@types/node-fetch": "^2.5.7",
|
||||||
"@types/shelljs": "^0.8.7",
|
"@types/shelljs": "^0.8.8",
|
||||||
"@types/supertest": "^2.0.8",
|
"@types/supertest": "^2.0.10",
|
||||||
"nodemon": "^2.0.3",
|
"nodemon": "^2.0.4",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"supertest": "^4.0.2",
|
"supertest": "^4.0.2",
|
||||||
"tslint": "^6.1.1",
|
"tslint": "^6.1.3",
|
||||||
"tslint-jasmine-noSkipOrFocus": "^1.0.9",
|
"tslint-jasmine-noSkipOrFocus": "^1.0.9",
|
||||||
"typescript": "^3.8.3"
|
"typescript": "^4.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -214,23 +214,24 @@ describe('GithubApi', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should call \'https.request()\' with the correct options', () => {
|
it('should call \'https.request()\' with the correct options', async () => {
|
||||||
const requestHandler = nock('https://api.github.com')
|
const requestHandler = nock('https://api.github.com')
|
||||||
.intercept('/path', 'method')
|
.intercept('/path', 'method')
|
||||||
.reply(200);
|
.reply(200);
|
||||||
|
|
||||||
(api as any).request('method', '/path');
|
await (api as any).request('method', '/path');
|
||||||
requestHandler.done();
|
requestHandler.done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should add the \'Authorization\' header containing the \'githubToken\'', () => {
|
it('should add the \'Authorization\' header containing the \'githubToken\'', async () => {
|
||||||
const requestHandler = nock('https://api.github.com')
|
const requestHandler = nock('https://api.github.com')
|
||||||
.intercept('/path', 'method', undefined, {
|
.intercept('/path', 'method', undefined, {
|
||||||
reqheaders: {Authorization: 'token 12345'},
|
reqheaders: {Authorization: 'token 12345'},
|
||||||
})
|
})
|
||||||
.reply(200);
|
.reply(200);
|
||||||
(api as any).request('method', '/path');
|
|
||||||
|
await (api as any).request('method', '/path');
|
||||||
requestHandler.done();
|
requestHandler.done();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -244,12 +245,13 @@ describe('GithubApi', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('should \'JSON.stringify\' and send the data along with the request', () => {
|
it('should \'JSON.stringify\' and send the data along with the request', async () => {
|
||||||
const data = {key: 'value'};
|
const data = {key: 'value'};
|
||||||
const requestHandler = nock('https://api.github.com')
|
const requestHandler = nock('https://api.github.com')
|
||||||
.intercept('/path', 'method', JSON.stringify(data))
|
.intercept('/path', 'method', JSON.stringify(data))
|
||||||
.reply(200);
|
.reply(200);
|
||||||
(api as any).request('method', '/path', data);
|
|
||||||
|
await (api as any).request('method', '/path', data);
|
||||||
requestHandler.done();
|
requestHandler.done();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -22,7 +22,7 @@ you don't need to specify values for those.
|
|||||||
The domain name of the server.
|
The domain name of the server.
|
||||||
|
|
||||||
- `AIO_GITHUB_ORGANIZATION`:
|
- `AIO_GITHUB_ORGANIZATION`:
|
||||||
The GitHub organization whose teams are whitelisted for accepting build artifacts.
|
The GitHub organization whose teams are trusted for accepting build artifacts.
|
||||||
See also `AIO_GITHUB_TEAM_SLUGS`.
|
See also `AIO_GITHUB_TEAM_SLUGS`.
|
||||||
|
|
||||||
- `AIO_GITHUB_REPO`:
|
- `AIO_GITHUB_REPO`:
|
||||||
|
@ -98,7 +98,7 @@ This section describes how each of the aforementioned sub-tasks is accomplished:
|
|||||||
Such a label can only have been added by a maintainer (with the necessary rights) and
|
Such a label can only have been added by a maintainer (with the necessary rights) and
|
||||||
designates that they have manually verified the PR contents.
|
designates that they have manually verified the PR contents.
|
||||||
2. We can verify (again using the GitHub API) the author's membership in one of the
|
2. We can verify (again using the GitHub API) the author's membership in one of the
|
||||||
whitelisted/trusted GitHub teams. For this operation, we need a Personal Access Token with the
|
trusted GitHub teams. For this operation, we need a Personal Access Token with the
|
||||||
`read:org` scope issued by a user that can "see" the specified GitHub organization.
|
`read:org` scope issued by a user that can "see" the specified GitHub organization.
|
||||||
Here too, we use the token by @mary-poppins.
|
Here too, we use the token by @mary-poppins.
|
||||||
|
|
||||||
|
2
aio/content/examples/.gitignore
vendored
2
aio/content/examples/.gitignore
vendored
@ -17,6 +17,7 @@
|
|||||||
**/e2e/tsconfig.e2e.json
|
**/e2e/tsconfig.e2e.json
|
||||||
**/src/karma.conf.js
|
**/src/karma.conf.js
|
||||||
**/.angular-cli.json
|
**/.angular-cli.json
|
||||||
|
**/.browserslistrc
|
||||||
**/.editorconfig
|
**/.editorconfig
|
||||||
**/.gitignore
|
**/.gitignore
|
||||||
**/angular.json
|
**/angular.json
|
||||||
@ -30,7 +31,6 @@
|
|||||||
**/tslint.json
|
**/tslint.json
|
||||||
**/karma-test-shim.js
|
**/karma-test-shim.js
|
||||||
**/browser-test-shim.js
|
**/browser-test-shim.js
|
||||||
**/browserslist
|
|
||||||
**/node_modules
|
**/node_modules
|
||||||
|
|
||||||
# built files
|
# built files
|
||||||
|
@ -21,11 +21,13 @@ import { ItemDirective } from './item.directive';
|
|||||||
ItemDirective
|
ItemDirective
|
||||||
],
|
],
|
||||||
// #enddocregion declarations
|
// #enddocregion declarations
|
||||||
|
// #docregion imports
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule,
|
||||||
FormsModule,
|
FormsModule,
|
||||||
HttpClientModule
|
HttpClientModule
|
||||||
],
|
],
|
||||||
|
// #enddocregion imports
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
/*
|
||||||
|
* This example project is special in that it is not a cli app. To run tests appropriate for this
|
||||||
|
* project, the test command is overwritten in `aio/content/examples/observables/example-config.json`.
|
||||||
|
*
|
||||||
|
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
|
||||||
|
* tests for this project.
|
||||||
|
*
|
||||||
|
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
|
||||||
|
*/
|
@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"tests": [
|
||||||
|
{
|
||||||
|
"cmd": "yarn",
|
||||||
|
"args": ["tsc", "--project", "tsconfig.spec.json", "--module", "commonjs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmd": "yarn",
|
||||||
|
"args": ["jasmine", "out-tsc/**/*.spec.js"]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
@ -0,0 +1,26 @@
|
|||||||
|
import { docRegionChain, docRegionObservable, docRegionUnsubscribe } from './observables';
|
||||||
|
|
||||||
|
describe('observables', () => {
|
||||||
|
it('should print 2', (doneFn: DoneFn) => {
|
||||||
|
const consoleLogSpy = spyOn(console, 'log');
|
||||||
|
const observable = docRegionObservable(console);
|
||||||
|
observable.subscribe(() => {
|
||||||
|
expect(consoleLogSpy).toHaveBeenCalledTimes(1);
|
||||||
|
expect(consoleLogSpy).toHaveBeenCalledWith(2);
|
||||||
|
doneFn();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should close the subscription', () => {
|
||||||
|
const subscription = docRegionUnsubscribe();
|
||||||
|
expect(subscription.closed).toBeTruthy();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should chain an observable', (doneFn: DoneFn) => {
|
||||||
|
const observable = docRegionChain();
|
||||||
|
observable.subscribe(value => {
|
||||||
|
expect(value).toBe(4);
|
||||||
|
doneFn();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
@ -1,40 +1,72 @@
|
|||||||
import { map } from 'rxjs/operators';
|
// #docplaster
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
// #docregion observable
|
export function docRegionObservable(console: Console) {
|
||||||
|
// #docregion observable
|
||||||
|
|
||||||
// declare a publishing operation
|
// declare a publishing operation
|
||||||
const observable = new Observable<number>(observer => {
|
const observable = new Observable<number>(observer => {
|
||||||
// Subscriber fn...
|
// Subscriber fn...
|
||||||
});
|
// #enddocregion observable
|
||||||
|
// The below code is used for unit testing only
|
||||||
|
observer.next(2);
|
||||||
|
// #docregion observable
|
||||||
|
});
|
||||||
|
|
||||||
// initiate execution
|
// initiate execution
|
||||||
observable.subscribe(() => {
|
observable.subscribe(value => {
|
||||||
// observer handles notifications
|
// observer handles notifications
|
||||||
});
|
// #enddocregion observable
|
||||||
|
// The below code is used for unit testing only
|
||||||
|
console.log(value);
|
||||||
|
// #docregion observable
|
||||||
|
});
|
||||||
|
|
||||||
// #enddocregion observable
|
// #enddocregion observable
|
||||||
|
return observable;
|
||||||
|
}
|
||||||
|
|
||||||
// #docregion unsubscribe
|
export function docRegionUnsubscribe() {
|
||||||
|
const observable = new Observable<number>(() => {
|
||||||
|
// Subscriber fn...
|
||||||
|
});
|
||||||
|
// #docregion unsubscribe
|
||||||
|
|
||||||
const subscription = observable.subscribe(() => {
|
const subscription = observable.subscribe(() => {
|
||||||
// observer handles notifications
|
// observer handles notifications
|
||||||
});
|
});
|
||||||
|
|
||||||
subscription.unsubscribe();
|
subscription.unsubscribe();
|
||||||
|
|
||||||
// #enddocregion unsubscribe
|
// #enddocregion unsubscribe
|
||||||
|
return subscription;
|
||||||
|
}
|
||||||
|
|
||||||
// #docregion error
|
export function docRegionError() {
|
||||||
|
const observable = new Observable<number>(() => {
|
||||||
|
// Subscriber fn...
|
||||||
|
});
|
||||||
|
|
||||||
observable.subscribe(() => {
|
// #docregion error
|
||||||
throw Error('my error');
|
observable.subscribe(() => {
|
||||||
});
|
throw new Error('my error');
|
||||||
|
});
|
||||||
|
// #enddocregion error
|
||||||
|
}
|
||||||
|
|
||||||
// #enddocregion error
|
export function docRegionChain() {
|
||||||
|
let observable = new Observable<number>(observer => {
|
||||||
|
// Subscriber fn...
|
||||||
|
observer.next(2);
|
||||||
|
});
|
||||||
|
|
||||||
// #docregion chain
|
observable =
|
||||||
|
// #docregion chain
|
||||||
|
|
||||||
observable.pipe(map(v => 2 * v));
|
observable.pipe(map(v => 2 * v));
|
||||||
|
|
||||||
// #enddocregion chain
|
// #enddocregion chain
|
||||||
|
return observable;
|
||||||
|
}
|
||||||
|
@ -0,0 +1,23 @@
|
|||||||
|
import { docRegionError, docRegionPromise } from './promises';
|
||||||
|
|
||||||
|
describe('promises', () => {
|
||||||
|
it('should print 2', (doneFn: DoneFn) => {
|
||||||
|
const consoleLogSpy = spyOn(console, 'log');
|
||||||
|
const pr = docRegionPromise(console, 2);
|
||||||
|
pr.then((value) => {
|
||||||
|
expect(consoleLogSpy).toHaveBeenCalledTimes(1);
|
||||||
|
expect(consoleLogSpy).toHaveBeenCalledWith(2);
|
||||||
|
expect(value).toBe(4);
|
||||||
|
doneFn();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should throw an error', (doneFn: DoneFn) => {
|
||||||
|
const promise = docRegionError();
|
||||||
|
promise
|
||||||
|
.then(() => {
|
||||||
|
throw new Error('Promise should be rejected.');
|
||||||
|
},
|
||||||
|
() => doneFn());
|
||||||
|
});
|
||||||
|
});
|
@ -1,25 +1,44 @@
|
|||||||
// #docregion promise
|
// #docplaster
|
||||||
// initiate execution
|
|
||||||
const promise = new Promise<number>((resolve, reject) => {
|
export function docRegionPromise(console: Console, inputValue: number) {
|
||||||
|
// #docregion promise
|
||||||
|
// initiate execution
|
||||||
|
let promise = new Promise<number>((resolve, reject) => {
|
||||||
// Executer fn...
|
// Executer fn...
|
||||||
});
|
// #enddocregion promise
|
||||||
|
// The below is used in the unit tests.
|
||||||
promise.then(value => {
|
resolve(inputValue);
|
||||||
|
// #docregion promise
|
||||||
|
});
|
||||||
|
// #enddocregion promise
|
||||||
|
promise =
|
||||||
|
// #docregion promise
|
||||||
|
promise.then(value => {
|
||||||
// handle result here
|
// handle result here
|
||||||
});
|
// #enddocregion promise
|
||||||
|
// The below is used in the unit tests.
|
||||||
|
console.log(value);
|
||||||
|
return value;
|
||||||
|
// #docregion promise
|
||||||
|
});
|
||||||
|
// #enddocregion promise
|
||||||
|
promise =
|
||||||
|
// #docregion chain
|
||||||
|
promise.then(v => 2 * v);
|
||||||
|
// #enddocregion chain
|
||||||
|
|
||||||
// #enddocregion promise
|
return promise;
|
||||||
|
}
|
||||||
|
|
||||||
// #docregion chain
|
export function docRegionError() {
|
||||||
|
let promise = Promise.resolve();
|
||||||
|
promise =
|
||||||
|
// #docregion error
|
||||||
|
|
||||||
promise.then(v => 2 * v);
|
promise.then(() => {
|
||||||
|
throw new Error('my error');
|
||||||
|
});
|
||||||
|
|
||||||
// #enddocregion chain
|
// #enddocregion error
|
||||||
|
return promise;
|
||||||
// #docregion error
|
}
|
||||||
|
|
||||||
promise.then(() => {
|
|
||||||
throw Error('my error');
|
|
||||||
});
|
|
||||||
|
|
||||||
// #enddocregion error
|
|
||||||
|
@ -1,12 +1,8 @@
|
|||||||
import { browser, element, by } from 'protractor';
|
import { browser, by, element } from 'protractor';
|
||||||
|
|
||||||
describe('Component Communication Cookbook Tests', () => {
|
describe('Component Communication Cookbook Tests', () => {
|
||||||
|
|
||||||
// Note: '?e2e' which app can read to know it is running in protractor
|
beforeEach(() => browser.get(browser.baseUrl));
|
||||||
// e.g. `if (!/e2e/.test(location.search)) { ...`
|
|
||||||
beforeAll(() => {
|
|
||||||
browser.get('?e2e');
|
|
||||||
});
|
|
||||||
|
|
||||||
describe('Parent-to-child communication', () => {
|
describe('Parent-to-child communication', () => {
|
||||||
// #docregion parent-to-child
|
// #docregion parent-to-child
|
||||||
@ -15,7 +11,7 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
const masterName = 'Master';
|
const masterName = 'Master';
|
||||||
|
|
||||||
it('should pass properties to children properly', () => {
|
it('should pass properties to children properly', () => {
|
||||||
const parent = element.all(by.tagName('app-hero-parent')).get(0);
|
const parent = element(by.tagName('app-hero-parent'));
|
||||||
const heroes = parent.all(by.tagName('app-hero-child'));
|
const heroes = parent.all(by.tagName('app-hero-child'));
|
||||||
|
|
||||||
for (let i = 0; i < heroNames.length; i++) {
|
for (let i = 0; i < heroNames.length; i++) {
|
||||||
@ -35,7 +31,7 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
it('should display trimmed, non-empty names', () => {
|
it('should display trimmed, non-empty names', () => {
|
||||||
const nonEmptyNameIndex = 0;
|
const nonEmptyNameIndex = 0;
|
||||||
const nonEmptyName = '"Dr IQ"';
|
const nonEmptyName = '"Dr IQ"';
|
||||||
const parent = element.all(by.tagName('app-name-parent')).get(0);
|
const parent = element(by.tagName('app-name-parent'));
|
||||||
const hero = parent.all(by.tagName('app-name-child')).get(nonEmptyNameIndex);
|
const hero = parent.all(by.tagName('app-name-child')).get(nonEmptyNameIndex);
|
||||||
|
|
||||||
const displayName = hero.element(by.tagName('h3')).getText();
|
const displayName = hero.element(by.tagName('h3')).getText();
|
||||||
@ -45,7 +41,7 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
it('should replace empty name with default name', () => {
|
it('should replace empty name with default name', () => {
|
||||||
const emptyNameIndex = 1;
|
const emptyNameIndex = 1;
|
||||||
const defaultName = '"<no name set>"';
|
const defaultName = '"<no name set>"';
|
||||||
const parent = element.all(by.tagName('app-name-parent')).get(0);
|
const parent = element(by.tagName('app-name-parent'));
|
||||||
const hero = parent.all(by.tagName('app-name-child')).get(emptyNameIndex);
|
const hero = parent.all(by.tagName('app-name-child')).get(emptyNameIndex);
|
||||||
|
|
||||||
const displayName = hero.element(by.tagName('h3')).getText();
|
const displayName = hero.element(by.tagName('h3')).getText();
|
||||||
@ -70,12 +66,13 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
expect(actual.logs.get(0).getText()).toBe(initialLog);
|
expect(actual.logs.get(0).getText()).toBe(initialLog);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set expected values after clicking \'Minor\' twice', () => {
|
it('should set expected values after clicking \'Minor\' twice', async () => {
|
||||||
const repoTag = element(by.tagName('app-version-parent'));
|
const repoTag = element(by.tagName('app-version-parent'));
|
||||||
const newMinorButton = repoTag.all(by.tagName('button')).get(0);
|
const newMinorButton = repoTag.all(by.tagName('button')).get(0);
|
||||||
|
|
||||||
newMinorButton.click().then(() => {
|
await newMinorButton.click();
|
||||||
newMinorButton.click().then(() => {
|
await newMinorButton.click();
|
||||||
|
|
||||||
const actual = getActual();
|
const actual = getActual();
|
||||||
|
|
||||||
const labelAfter2Minor = 'Version 1.25';
|
const labelAfter2Minor = 'Version 1.25';
|
||||||
@ -85,23 +82,20 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
expect(actual.count).toBe(3);
|
expect(actual.count).toBe(3);
|
||||||
expect(actual.logs.get(2).getText()).toBe(logAfter2Minor);
|
expect(actual.logs.get(2).getText()).toBe(logAfter2Minor);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should set expected values after clicking \'Major\' once', () => {
|
it('should set expected values after clicking \'Major\' once', async () => {
|
||||||
const repoTag = element(by.tagName('app-version-parent'));
|
const repoTag = element(by.tagName('app-version-parent'));
|
||||||
const newMajorButton = repoTag.all(by.tagName('button')).get(1);
|
const newMajorButton = repoTag.all(by.tagName('button')).get(1);
|
||||||
|
|
||||||
newMajorButton.click().then(() => {
|
await newMajorButton.click();
|
||||||
const actual = getActual();
|
const actual = getActual();
|
||||||
|
|
||||||
const labelAfterMajor = 'Version 2.0';
|
const labelAfterMajor = 'Version 2.0';
|
||||||
const logAfterMajor = 'major changed from 1 to 2, minor changed from 25 to 0';
|
const logAfterMajor = 'major changed from 1 to 2, minor changed from 23 to 0';
|
||||||
|
|
||||||
expect(actual.label).toBe(labelAfterMajor);
|
expect(actual.label).toBe(labelAfterMajor);
|
||||||
expect(actual.count).toBe(4);
|
expect(actual.count).toBe(2);
|
||||||
expect(actual.logs.get(3).getText()).toBe(logAfterMajor);
|
expect(actual.logs.get(1).getText()).toBe(logAfterMajor);
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getActual() {
|
function getActual() {
|
||||||
@ -118,110 +112,125 @@ describe('Component Communication Cookbook Tests', () => {
|
|||||||
}
|
}
|
||||||
// ...
|
// ...
|
||||||
// #enddocregion parent-to-child-onchanges
|
// #enddocregion parent-to-child-onchanges
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Child-to-parent communication', () => {
|
describe('Child-to-parent communication', () => {
|
||||||
// #docregion child-to-parent
|
// #docregion child-to-parent
|
||||||
// ...
|
// ...
|
||||||
it('should not emit the event initially', () => {
|
it('should not emit the event initially', () => {
|
||||||
const voteLabel = element(by.tagName('app-vote-taker'))
|
const voteLabel = element(by.tagName('app-vote-taker')).element(by.tagName('h3'));
|
||||||
.element(by.tagName('h3')).getText();
|
expect(voteLabel.getText()).toBe('Agree: 0, Disagree: 0');
|
||||||
expect(voteLabel).toBe('Agree: 0, Disagree: 0');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should process Agree vote', () => {
|
it('should process Agree vote', async () => {
|
||||||
|
const voteLabel = element(by.tagName('app-vote-taker')).element(by.tagName('h3'));
|
||||||
const agreeButton1 = element.all(by.tagName('app-voter')).get(0)
|
const agreeButton1 = element.all(by.tagName('app-voter')).get(0)
|
||||||
.all(by.tagName('button')).get(0);
|
.all(by.tagName('button')).get(0);
|
||||||
agreeButton1.click().then(() => {
|
|
||||||
const voteLabel = element(by.tagName('app-vote-taker'))
|
await agreeButton1.click();
|
||||||
.element(by.tagName('h3')).getText();
|
|
||||||
expect(voteLabel).toBe('Agree: 1, Disagree: 0');
|
expect(voteLabel.getText()).toBe('Agree: 1, Disagree: 0');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should process Disagree vote', () => {
|
it('should process Disagree vote', async () => {
|
||||||
|
const voteLabel = element(by.tagName('app-vote-taker')).element(by.tagName('h3'));
|
||||||
const agreeButton1 = element.all(by.tagName('app-voter')).get(1)
|
const agreeButton1 = element.all(by.tagName('app-voter')).get(1)
|
||||||
.all(by.tagName('button')).get(1);
|
.all(by.tagName('button')).get(1);
|
||||||
agreeButton1.click().then(() => {
|
|
||||||
const voteLabel = element(by.tagName('app-vote-taker'))
|
await agreeButton1.click();
|
||||||
.element(by.tagName('h3')).getText();
|
|
||||||
expect(voteLabel).toBe('Agree: 1, Disagree: 1');
|
expect(voteLabel.getText()).toBe('Agree: 0, Disagree: 1');
|
||||||
});
|
|
||||||
});
|
});
|
||||||
// ...
|
// ...
|
||||||
// #enddocregion child-to-parent
|
// #enddocregion child-to-parent
|
||||||
});
|
});
|
||||||
|
|
||||||
// Can't run timer tests in protractor because
|
describe('Parent calls child via local var', () => {
|
||||||
// interaction w/ zones causes all tests to freeze & timeout.
|
countDownTimerTests('app-countdown-parent-lv');
|
||||||
xdescribe('Parent calls child via local var', () => {
|
|
||||||
countDownTimerTests('countdown-parent-lv');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
xdescribe('Parent calls ViewChild', () => {
|
describe('Parent calls ViewChild', () => {
|
||||||
countDownTimerTests('countdown-parent-vc');
|
countDownTimerTests('app-countdown-parent-vc');
|
||||||
});
|
});
|
||||||
|
|
||||||
function countDownTimerTests(parentTag: string) {
|
function countDownTimerTests(parentTag: string) {
|
||||||
// #docregion countdown-timer-tests
|
// #docregion countdown-timer-tests
|
||||||
// ...
|
// ...
|
||||||
it('timer and parent seconds should match', () => {
|
// The tests trigger periodic asynchronous operations (via `setInterval()`), which will prevent
|
||||||
|
// the app from stabilizing. See https://angular.io/api/core/ApplicationRef#is-stable-examples
|
||||||
|
// for more details.
|
||||||
|
// To allow the tests to complete, we will disable automatically waiting for the Angular app to
|
||||||
|
// stabilize.
|
||||||
|
beforeEach(() => browser.waitForAngularEnabled(false));
|
||||||
|
afterEach(() => browser.waitForAngularEnabled(true));
|
||||||
|
|
||||||
|
it('timer and parent seconds should match', async () => {
|
||||||
const parent = element(by.tagName(parentTag));
|
const parent = element(by.tagName(parentTag));
|
||||||
const message = parent.element(by.tagName('app-countdown-timer')).getText();
|
const startButton = parent.element(by.buttonText('Start'));
|
||||||
browser.sleep(10); // give `seconds` a chance to catchup with `message`
|
const seconds = parent.element(by.className('seconds'));
|
||||||
const seconds = parent.element(by.className('seconds')).getText();
|
const timer = parent.element(by.tagName('app-countdown-timer'));
|
||||||
expect(message).toContain(seconds);
|
|
||||||
|
await startButton.click();
|
||||||
|
|
||||||
|
// Wait for `<app-countdown-timer>` to be populated with any text.
|
||||||
|
await browser.wait(() => timer.getText(), 2000);
|
||||||
|
|
||||||
|
expect(await timer.getText()).toContain(await seconds.getText());
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should stop the countdown', () => {
|
it('should stop the countdown', async () => {
|
||||||
const parent = element(by.tagName(parentTag));
|
const parent = element(by.tagName(parentTag));
|
||||||
const stopButton = parent.all(by.tagName('button')).get(1);
|
const startButton = parent.element(by.buttonText('Start'));
|
||||||
|
const stopButton = parent.element(by.buttonText('Stop'));
|
||||||
|
const timer = parent.element(by.tagName('app-countdown-timer'));
|
||||||
|
|
||||||
stopButton.click().then(() => {
|
await startButton.click();
|
||||||
const message = parent.element(by.tagName('app-countdown-timer')).getText();
|
expect(await timer.getText()).not.toContain('Holding');
|
||||||
expect(message).toContain('Holding');
|
|
||||||
});
|
await stopButton.click();
|
||||||
|
expect(await timer.getText()).toContain('Holding');
|
||||||
});
|
});
|
||||||
// ...
|
// ...
|
||||||
// #enddocregion countdown-timer-tests
|
// #enddocregion countdown-timer-tests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
describe('Parent and children communicate via a service', () => {
|
describe('Parent and children communicate via a service', () => {
|
||||||
// #docregion bidirectional-service
|
// #docregion bidirectional-service
|
||||||
// ...
|
// ...
|
||||||
it('should announce a mission', () => {
|
it('should announce a mission', async () => {
|
||||||
const missionControl = element(by.tagName('app-mission-control'));
|
const missionControl = element(by.tagName('app-mission-control'));
|
||||||
const announceButton = missionControl.all(by.tagName('button')).get(0);
|
const announceButton = missionControl.all(by.tagName('button')).get(0);
|
||||||
announceButton.click().then(() => {
|
|
||||||
const history = missionControl.all(by.tagName('li'));
|
const history = missionControl.all(by.tagName('li'));
|
||||||
|
|
||||||
|
await announceButton.click();
|
||||||
|
|
||||||
expect(history.count()).toBe(1);
|
expect(history.count()).toBe(1);
|
||||||
expect(history.get(0).getText()).toMatch(/Mission.* announced/);
|
expect(history.get(0).getText()).toMatch(/Mission.* announced/);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should confirm the mission by Lovell', async () => {
|
||||||
|
await testConfirmMission(1, 'Lovell');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the mission by Lovell', () => {
|
it('should confirm the mission by Haise', async () => {
|
||||||
testConfirmMission(1, 2, 'Lovell');
|
await testConfirmMission(3, 'Haise');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the mission by Haise', () => {
|
it('should confirm the mission by Swigert', async () => {
|
||||||
testConfirmMission(3, 3, 'Haise');
|
await testConfirmMission(2, 'Swigert');
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should confirm the mission by Swigert', () => {
|
async function testConfirmMission(buttonIndex: number, astronaut: string) {
|
||||||
testConfirmMission(2, 4, 'Swigert');
|
|
||||||
});
|
|
||||||
|
|
||||||
function testConfirmMission(buttonIndex: number, expectedLogCount: number, astronaut: string) {
|
|
||||||
const confirmedLog = ' confirmed the mission';
|
|
||||||
const missionControl = element(by.tagName('app-mission-control'));
|
const missionControl = element(by.tagName('app-mission-control'));
|
||||||
|
const announceButton = missionControl.all(by.tagName('button')).get(0);
|
||||||
const confirmButton = missionControl.all(by.tagName('button')).get(buttonIndex);
|
const confirmButton = missionControl.all(by.tagName('button')).get(buttonIndex);
|
||||||
confirmButton.click().then(() => {
|
|
||||||
const history = missionControl.all(by.tagName('li'));
|
const history = missionControl.all(by.tagName('li'));
|
||||||
expect(history.count()).toBe(expectedLogCount);
|
|
||||||
expect(history.get(expectedLogCount - 1).getText()).toBe(astronaut + confirmedLog);
|
await announceButton.click();
|
||||||
});
|
await confirmButton.click();
|
||||||
|
|
||||||
|
expect(history.count()).toBe(2);
|
||||||
|
expect(history.get(1).getText()).toBe(`${astronaut} confirmed the mission`);
|
||||||
}
|
}
|
||||||
// ...
|
// ...
|
||||||
// #enddocregion bidirectional-service
|
// #enddocregion bidirectional-service
|
||||||
|
@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"tests": [
|
|
||||||
{
|
|
||||||
"cmd": "yarn",
|
|
||||||
"args": [
|
|
||||||
"e2e",
|
|
||||||
"--protractor-config=e2e/protractor-puppeteer.conf.js",
|
|
||||||
"--no-webdriver-update",
|
|
||||||
"--port={PORT}"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
@ -30,22 +30,21 @@
|
|||||||
<app-vote-taker></app-vote-taker>
|
<app-vote-taker></app-vote-taker>
|
||||||
</div>
|
</div>
|
||||||
<a href="#top" class="to-top">Back to Top</a>
|
<a href="#top" class="to-top">Back to Top</a>
|
||||||
<hr>
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
<div id="parent-to-child-local-var">
|
<div id="parent-to-child-local-var">
|
||||||
<app-countdown-parent-lv></app-countdown-parent-lv>
|
<app-countdown-parent-lv></app-countdown-parent-lv>
|
||||||
</div>
|
</div>
|
||||||
<a href="#top" class="to-top">Back to Top</a>
|
<a href="#top" class="to-top">Back to Top</a>
|
||||||
<hr>
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
<div id="parent-to-view-child">
|
<div id="parent-to-view-child">
|
||||||
<app-countdown-parent-vc></app-countdown-parent-vc>
|
<app-countdown-parent-vc></app-countdown-parent-vc>
|
||||||
</div>
|
</div>
|
||||||
<a href="#top" class="to-top">Back to Top</a>
|
<a href="#top" class="to-top">Back to Top</a>
|
||||||
<hr>
|
|
||||||
|
|
||||||
|
<hr>
|
||||||
<div id="bidirectional-service">
|
<div id="bidirectional-service">
|
||||||
<app-mission-control></app-mission-control>
|
<app-mission-control></app-mission-control>
|
||||||
</div>
|
</div>
|
||||||
<a href="#top" class="to-top">Back to Top</a>
|
<a href="#top" class="to-top">Back to Top</a>
|
||||||
<hr>
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
@ -15,10 +15,17 @@ import { VersionParentComponent } from './version-parent.component';
|
|||||||
import { VoterComponent } from './voter.component';
|
import { VoterComponent } from './voter.component';
|
||||||
import { VoteTakerComponent } from './votetaker.component';
|
import { VoteTakerComponent } from './votetaker.component';
|
||||||
|
|
||||||
const directives: any[] = [
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [
|
||||||
|
BrowserModule,
|
||||||
|
],
|
||||||
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
AstronautComponent,
|
AstronautComponent,
|
||||||
|
CountdownLocalVarParentComponent,
|
||||||
CountdownTimerComponent,
|
CountdownTimerComponent,
|
||||||
|
CountdownViewChildParentComponent,
|
||||||
HeroChildComponent,
|
HeroChildComponent,
|
||||||
HeroParentComponent,
|
HeroParentComponent,
|
||||||
MissionControlComponent,
|
MissionControlComponent,
|
||||||
@ -27,28 +34,8 @@ const directives: any[] = [
|
|||||||
VersionChildComponent,
|
VersionChildComponent,
|
||||||
VersionParentComponent,
|
VersionParentComponent,
|
||||||
VoterComponent,
|
VoterComponent,
|
||||||
VoteTakerComponent
|
VoteTakerComponent,
|
||||||
];
|
|
||||||
|
|
||||||
const schemas: any[] = [];
|
|
||||||
|
|
||||||
// Include Countdown examples
|
|
||||||
// unless in e2e tests which they break.
|
|
||||||
if (!/e2e/.test(location.search)) {
|
|
||||||
console.log('adding countdown timer examples');
|
|
||||||
directives.push(CountdownLocalVarParentComponent);
|
|
||||||
directives.push(CountdownViewChildParentComponent);
|
|
||||||
} else {
|
|
||||||
// In e2e test use CUSTOM_ELEMENTS_SCHEMA to suppress unknown element errors
|
|
||||||
schemas.push(CUSTOM_ELEMENTS_SCHEMA);
|
|
||||||
}
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
imports: [
|
|
||||||
BrowserModule
|
|
||||||
],
|
],
|
||||||
declarations: directives,
|
|
||||||
bootstrap: [ AppComponent ],
|
bootstrap: [ AppComponent ],
|
||||||
schemas
|
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
@ -1,19 +1,16 @@
|
|||||||
// #docregion
|
// #docregion
|
||||||
import { Component, OnDestroy, OnInit } from '@angular/core';
|
import { Component, OnDestroy } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-countdown-timer',
|
selector: 'app-countdown-timer',
|
||||||
template: '<p>{{message}}</p>'
|
template: '<p>{{message}}</p>'
|
||||||
})
|
})
|
||||||
export class CountdownTimerComponent implements OnInit, OnDestroy {
|
export class CountdownTimerComponent implements OnDestroy {
|
||||||
|
|
||||||
intervalId = 0;
|
intervalId = 0;
|
||||||
message = '';
|
message = '';
|
||||||
seconds = 11;
|
seconds = 11;
|
||||||
|
|
||||||
clearTimer() { clearInterval(this.intervalId); }
|
|
||||||
|
|
||||||
ngOnInit() { this.start(); }
|
|
||||||
ngOnDestroy() { this.clearTimer(); }
|
ngOnDestroy() { this.clearTimer(); }
|
||||||
|
|
||||||
start() { this.countDown(); }
|
start() { this.countDown(); }
|
||||||
@ -22,6 +19,8 @@ export class CountdownTimerComponent implements OnInit, OnDestroy {
|
|||||||
this.message = `Holding at T-${this.seconds} seconds`;
|
this.message = `Holding at T-${this.seconds} seconds`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private clearTimer() { clearInterval(this.intervalId); }
|
||||||
|
|
||||||
private countDown() {
|
private countDown() {
|
||||||
this.clearTimer();
|
this.clearTimer();
|
||||||
this.intervalId = window.setInterval(() => {
|
this.intervalId = window.setInterval(() => {
|
||||||
|
@ -24,7 +24,7 @@ export class UploaderService {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
upload(file: File) {
|
upload(file: File) {
|
||||||
if (!file) { return; }
|
if (!file) { return of<string>(); }
|
||||||
|
|
||||||
// COULD HAVE WRITTEN:
|
// COULD HAVE WRITTEN:
|
||||||
// return this.http.post('/upload/file', file, {
|
// return this.http.post('/upload/file', file, {
|
||||||
|
@ -41,7 +41,6 @@
|
|||||||
<!-- #enddocregion translated-plural -->
|
<!-- #enddocregion translated-plural -->
|
||||||
<!-- #docregion translated-select -->
|
<!-- #docregion translated-select -->
|
||||||
<!-- #docregion translate-select-1 -->
|
<!-- #docregion translate-select-1 -->
|
||||||
</trans-unit>
|
|
||||||
<trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
|
<trans-unit id="f99f34ac9bd4606345071bd813858dec29f3b7d1" datatype="html">
|
||||||
<source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
|
<source>The author is <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></source>
|
||||||
<target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
|
<target>L'auteur est <x id="ICU" equiv-text="{gender, select, male {...} female {...} other {...}}"/></target>
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
// TODO: Add unit tests for this file.
|
||||||
// tslint:disable: no-output-native
|
// tslint:disable: no-output-native
|
||||||
// #docregion
|
// #docregion
|
||||||
import { Component, Output, OnInit, EventEmitter, NgModule } from '@angular/core';
|
import { Component, Output, OnInit, EventEmitter, NgModule } from '@angular/core';
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"cmd": "yarn",
|
"cmd": "yarn",
|
||||||
"args": [ "tsc", "--project", "./tsconfig.app.json" ]
|
"args": ["tsc", "--project", "tsconfig.spec.json", "--module", "commonjs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmd": "yarn",
|
||||||
|
"args": ["jasmine", "out-tsc/**/*.spec.js"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
55
aio/content/examples/observables/src/creating.spec.ts
Normal file
55
aio/content/examples/observables/src/creating.spec.ts
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
import { docRegionFromEvent, docRegionSubscriber } from './creating';
|
||||||
|
|
||||||
|
describe('observables', () => {
|
||||||
|
it('should create an observable using the constructor', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
docRegionSubscriber(console);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(4);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[1],
|
||||||
|
[2],
|
||||||
|
[3],
|
||||||
|
['Finished sequence'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should listen to input changes', () => {
|
||||||
|
let triggerInputChange;
|
||||||
|
const input = {
|
||||||
|
value: 'Test',
|
||||||
|
addEventListener: jasmine
|
||||||
|
.createSpy('addEvent')
|
||||||
|
.and.callFake((eventName: string, cb: (e) => void) => {
|
||||||
|
if (eventName === 'keydown') {
|
||||||
|
triggerInputChange = cb;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
removeEventListener: jasmine.createSpy('removeEventListener'),
|
||||||
|
};
|
||||||
|
|
||||||
|
const document = { getElementById: () => input };
|
||||||
|
docRegionFromEvent(document);
|
||||||
|
triggerInputChange({keyCode: 65});
|
||||||
|
expect(input.value).toBe('Test');
|
||||||
|
|
||||||
|
triggerInputChange({keyCode: 27});
|
||||||
|
expect(input.value).toBe('');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call removeEventListener when unsubscribing', (doneFn: DoneFn) => {
|
||||||
|
const input = {
|
||||||
|
addEventListener: jasmine.createSpy('addEvent'),
|
||||||
|
removeEventListener: jasmine
|
||||||
|
.createSpy('removeEvent')
|
||||||
|
.and.callFake((eventName: string, cb: (e) => void) => {
|
||||||
|
if (eventName === 'keydown') {
|
||||||
|
doneFn();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
};
|
||||||
|
|
||||||
|
const document = { getElementById: () => input };
|
||||||
|
const subscription = docRegionFromEvent(document);
|
||||||
|
subscription.unsubscribe();
|
||||||
|
});
|
||||||
|
});
|
@ -1,10 +1,11 @@
|
|||||||
|
// #docplaster
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// #docregion subscriber
|
export function docRegionSubscriber(console) {
|
||||||
|
// #docregion subscriber
|
||||||
// This function runs when subscribe() is called
|
// This function runs when subscribe() is called
|
||||||
function sequenceSubscriber(observer) {
|
function sequenceSubscriber(observer) {
|
||||||
// synchronously deliver 1, 2, and 3, then complete
|
// synchronously deliver 1, 2, and 3, then complete
|
||||||
observer.next(1);
|
observer.next(1);
|
||||||
observer.next(2);
|
observer.next(2);
|
||||||
@ -14,24 +15,24 @@ function sequenceSubscriber(observer) {
|
|||||||
// unsubscribe function doesn't need to do anything in this
|
// unsubscribe function doesn't need to do anything in this
|
||||||
// because values are delivered synchronously
|
// because values are delivered synchronously
|
||||||
return {unsubscribe() {}};
|
return {unsubscribe() {}};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Observable that will deliver the above sequence
|
// Create a new Observable that will deliver the above sequence
|
||||||
const sequence = new Observable(sequenceSubscriber);
|
const sequence = new Observable(sequenceSubscriber);
|
||||||
|
|
||||||
// execute the Observable and print the result of each notification
|
// execute the Observable and print the result of each notification
|
||||||
sequence.subscribe({
|
sequence.subscribe({
|
||||||
next(num) { console.log(num); },
|
next(num) { console.log(num); },
|
||||||
complete() { console.log('Finished sequence'); }
|
complete() { console.log('Finished sequence'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Logs:
|
// Logs:
|
||||||
// 1
|
// 1
|
||||||
// 2
|
// 2
|
||||||
// 3
|
// 3
|
||||||
// Finished sequence
|
// Finished sequence
|
||||||
|
// #enddocregion subscriber
|
||||||
// #enddocregion subscriber
|
}
|
||||||
|
|
||||||
// #docregion fromevent
|
// #docregion fromevent
|
||||||
|
|
||||||
@ -51,16 +52,18 @@ function fromEvent(target, eventName) {
|
|||||||
|
|
||||||
// #enddocregion fromevent
|
// #enddocregion fromevent
|
||||||
|
|
||||||
// #docregion fromevent_use
|
export function docRegionFromEvent(document) {
|
||||||
|
// #docregion fromevent_use
|
||||||
|
|
||||||
const ESC_KEY = 27;
|
const ESC_KEY = 27;
|
||||||
const nameInput = document.getElementById('name') as HTMLInputElement;
|
const nameInput = document.getElementById('name') as HTMLInputElement;
|
||||||
|
|
||||||
const subscription = fromEvent(nameInput, 'keydown')
|
const subscription = fromEvent(nameInput, 'keydown').subscribe((e: KeyboardEvent) => {
|
||||||
.subscribe((e: KeyboardEvent) => {
|
|
||||||
if (e.keyCode === ESC_KEY) {
|
if (e.keyCode === ESC_KEY) {
|
||||||
nameInput.value = '';
|
nameInput.value = '';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
// #enddocregion fromevent_use
|
||||||
|
return subscription;
|
||||||
|
}
|
||||||
|
|
||||||
// #enddocregion fromevent_use
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
|
// TODO: Add unit tests for this file.
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// #docregion
|
// #docregion
|
||||||
|
|
||||||
// Create an Observable that will start listening to geolocation updates
|
// Create an Observable that will start listening to geolocation updates
|
||||||
|
48
aio/content/examples/observables/src/multicasting.spec.ts
Normal file
48
aio/content/examples/observables/src/multicasting.spec.ts
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
import { docRegionDelaySequence, docRegionMulticastSequence } from './multicasting';
|
||||||
|
|
||||||
|
describe('multicasting', () => {
|
||||||
|
let console;
|
||||||
|
beforeEach(() => {
|
||||||
|
jasmine.clock().install();
|
||||||
|
console = {log: jasmine.createSpy('log')};
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.clock().uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create an observable and emit in sequence', () => {
|
||||||
|
docRegionDelaySequence(console);
|
||||||
|
jasmine.clock().tick(10000);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(12);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[1],
|
||||||
|
['1st subscribe: 1'],
|
||||||
|
['2nd subscribe: 1'],
|
||||||
|
[2],
|
||||||
|
['1st subscribe: 2'],
|
||||||
|
['2nd subscribe: 2'],
|
||||||
|
[3],
|
||||||
|
['Finished sequence'],
|
||||||
|
['1st subscribe: 3'],
|
||||||
|
['1st sequence finished.'],
|
||||||
|
['2nd subscribe: 3'],
|
||||||
|
['2nd sequence finished.']
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create an observable and multicast the emissions', () => {
|
||||||
|
docRegionMulticastSequence(console);
|
||||||
|
jasmine.clock().tick(10000);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(7);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
['1st subscribe: 1'],
|
||||||
|
['1st subscribe: 2'],
|
||||||
|
['2nd subscribe: 2'],
|
||||||
|
['1st subscribe: 3'],
|
||||||
|
['2nd subscribe: 3'],
|
||||||
|
['1st sequence finished.'],
|
||||||
|
['2nd sequence finished.']
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,9 +1,10 @@
|
|||||||
|
// #docplaster
|
||||||
|
|
||||||
import { Observable } from 'rxjs';
|
import { Observable } from 'rxjs';
|
||||||
|
|
||||||
// #docregion delay_sequence
|
export function docRegionDelaySequence(console) {
|
||||||
|
// #docregion delay_sequence
|
||||||
function sequenceSubscriber(observer) {
|
function sequenceSubscriber(observer) {
|
||||||
const seq = [1, 2, 3];
|
const seq = [1, 2, 3];
|
||||||
let timeoutId;
|
let timeoutId;
|
||||||
|
|
||||||
@ -23,58 +24,61 @@ function sequenceSubscriber(observer) {
|
|||||||
doInSequence(seq, 0);
|
doInSequence(seq, 0);
|
||||||
|
|
||||||
// Unsubscribe should clear the timeout to stop execution
|
// Unsubscribe should clear the timeout to stop execution
|
||||||
return {unsubscribe() {
|
return {
|
||||||
|
unsubscribe() {
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}};
|
}
|
||||||
}
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new Observable that will deliver the above sequence
|
// Create a new Observable that will deliver the above sequence
|
||||||
const sequence = new Observable(sequenceSubscriber);
|
const sequence = new Observable(sequenceSubscriber);
|
||||||
|
|
||||||
sequence.subscribe({
|
sequence.subscribe({
|
||||||
next(num) { console.log(num); },
|
next(num) { console.log(num); },
|
||||||
complete() { console.log('Finished sequence'); }
|
complete() { console.log('Finished sequence'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// Logs:
|
// Logs:
|
||||||
// (at 1 second): 1
|
// (at 1 second): 1
|
||||||
// (at 2 seconds): 2
|
// (at 2 seconds): 2
|
||||||
// (at 3 seconds): 3
|
// (at 3 seconds): 3
|
||||||
// (at 3 seconds): Finished sequence
|
// (at 3 seconds): Finished sequence
|
||||||
|
|
||||||
// #enddocregion delay_sequence
|
// #enddocregion delay_sequence
|
||||||
|
|
||||||
// #docregion subscribe_twice
|
// #docregion subscribe_twice
|
||||||
|
|
||||||
// Subscribe starts the clock, and will emit after 1 second
|
// Subscribe starts the clock, and will emit after 1 second
|
||||||
sequence.subscribe({
|
sequence.subscribe({
|
||||||
next(num) { console.log('1st subscribe: ' + num); },
|
next(num) { console.log('1st subscribe: ' + num); },
|
||||||
complete() { console.log('1st sequence finished.'); }
|
complete() { console.log('1st sequence finished.'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// After 1/2 second, subscribe again.
|
// After 1/2 second, subscribe again.
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
sequence.subscribe({
|
sequence.subscribe({
|
||||||
next(num) { console.log('2nd subscribe: ' + num); },
|
next(num) { console.log('2nd subscribe: ' + num); },
|
||||||
complete() { console.log('2nd sequence finished.'); }
|
complete() { console.log('2nd sequence finished.'); }
|
||||||
});
|
});
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
// Logs:
|
// Logs:
|
||||||
// (at 1 second): 1st subscribe: 1
|
// (at 1 second): 1st subscribe: 1
|
||||||
// (at 1.5 seconds): 2nd subscribe: 1
|
// (at 1.5 seconds): 2nd subscribe: 1
|
||||||
// (at 2 seconds): 1st subscribe: 2
|
// (at 2 seconds): 1st subscribe: 2
|
||||||
// (at 2.5 seconds): 2nd subscribe: 2
|
// (at 2.5 seconds): 2nd subscribe: 2
|
||||||
// (at 3 seconds): 1st subscribe: 3
|
// (at 3 seconds): 1st subscribe: 3
|
||||||
// (at 3 seconds): 1st sequence finished
|
// (at 3 seconds): 1st sequence finished
|
||||||
// (at 3.5 seconds): 2nd subscribe: 3
|
// (at 3.5 seconds): 2nd subscribe: 3
|
||||||
// (at 3.5 seconds): 2nd sequence finished
|
// (at 3.5 seconds): 2nd sequence finished
|
||||||
|
|
||||||
// #enddocregion subscribe_twice
|
// #enddocregion subscribe_twice
|
||||||
|
}
|
||||||
|
|
||||||
// #docregion multicast_sequence
|
export function docRegionMulticastSequence(console) {
|
||||||
|
// #docregion multicast_sequence
|
||||||
function multicastSequenceSubscriber() {
|
function multicastSequenceSubscriber() {
|
||||||
const seq = [1, 2, 3];
|
const seq = [1, 2, 3];
|
||||||
// Keep track of each observer (one for every active subscription)
|
// Keep track of each observer (one for every active subscription)
|
||||||
const observers = [];
|
const observers = [];
|
||||||
@ -84,7 +88,7 @@ function multicastSequenceSubscriber() {
|
|||||||
|
|
||||||
// Return the subscriber function (runs when subscribe()
|
// Return the subscriber function (runs when subscribe()
|
||||||
// function is invoked)
|
// function is invoked)
|
||||||
return (observer) => {
|
return observer => {
|
||||||
observers.push(observer);
|
observers.push(observer);
|
||||||
// When this is the first subscription, start the sequence
|
// When this is the first subscription, start the sequence
|
||||||
if (observers.length === 1) {
|
if (observers.length === 1) {
|
||||||
@ -111,11 +115,11 @@ function multicastSequenceSubscriber() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run through an array of numbers, emitting one value
|
// Run through an array of numbers, emitting one value
|
||||||
// per second until it gets to the end of the array.
|
// per second until it gets to the end of the array.
|
||||||
function doSequence(observer, arr, idx) {
|
function doSequence(observer, arr, idx) {
|
||||||
return setTimeout(() => {
|
return setTimeout(() => {
|
||||||
observer.next(arr[idx]);
|
observer.next(arr[idx]);
|
||||||
if (idx === arr.length - 1) {
|
if (idx === arr.length - 1) {
|
||||||
@ -124,32 +128,33 @@ function doSequence(observer, arr, idx) {
|
|||||||
doSequence(observer, arr, ++idx);
|
doSequence(observer, arr, ++idx);
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a new Observable that will deliver the above sequence
|
// Create a new Observable that will deliver the above sequence
|
||||||
const multicastSequence = new Observable(multicastSequenceSubscriber());
|
const multicastSequence = new Observable(multicastSequenceSubscriber());
|
||||||
|
|
||||||
// Subscribe starts the clock, and begins to emit after 1 second
|
// Subscribe starts the clock, and begins to emit after 1 second
|
||||||
multicastSequence.subscribe({
|
multicastSequence.subscribe({
|
||||||
next(num) { console.log('1st subscribe: ' + num); },
|
next(num) { console.log('1st subscribe: ' + num); },
|
||||||
complete() { console.log('1st sequence finished.'); }
|
complete() { console.log('1st sequence finished.'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// After 1 1/2 seconds, subscribe again (should "miss" the first value).
|
// After 1 1/2 seconds, subscribe again (should "miss" the first value).
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
multicastSequence.subscribe({
|
multicastSequence.subscribe({
|
||||||
next(num) { console.log('2nd subscribe: ' + num); },
|
next(num) { console.log('2nd subscribe: ' + num); },
|
||||||
complete() { console.log('2nd sequence finished.'); }
|
complete() { console.log('2nd sequence finished.'); }
|
||||||
});
|
});
|
||||||
}, 1500);
|
}, 1500);
|
||||||
|
|
||||||
// Logs:
|
// Logs:
|
||||||
// (at 1 second): 1st subscribe: 1
|
// (at 1 second): 1st subscribe: 1
|
||||||
// (at 2 seconds): 1st subscribe: 2
|
// (at 2 seconds): 1st subscribe: 2
|
||||||
// (at 2 seconds): 2nd subscribe: 2
|
// (at 2 seconds): 2nd subscribe: 2
|
||||||
// (at 3 seconds): 1st subscribe: 3
|
// (at 3 seconds): 1st subscribe: 3
|
||||||
// (at 3 seconds): 1st sequence finished
|
// (at 3 seconds): 1st sequence finished
|
||||||
// (at 3 seconds): 2nd subscribe: 3
|
// (at 3 seconds): 2nd subscribe: 3
|
||||||
// (at 3 seconds): 2nd sequence finished
|
// (at 3 seconds): 2nd sequence finished
|
||||||
|
|
||||||
// #enddocregion multicast_sequence
|
// #enddocregion multicast_sequence
|
||||||
|
}
|
||||||
|
19
aio/content/examples/observables/src/subscribing.spec.ts
Normal file
19
aio/content/examples/observables/src/subscribing.spec.ts
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { docRegionObserver } from './subscribing';
|
||||||
|
|
||||||
|
describe('subscribing', () => {
|
||||||
|
it('should subscribe and emit', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
docRegionObserver(console);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(8);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
['Observer got a next value: 1'],
|
||||||
|
['Observer got a next value: 2'],
|
||||||
|
['Observer got a next value: 3'],
|
||||||
|
['Observer got a complete notification'],
|
||||||
|
['Observer got a next value: 1'],
|
||||||
|
['Observer got a next value: 2'],
|
||||||
|
['Observer got a next value: 3'],
|
||||||
|
['Observer got a complete notification'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,32 +1,35 @@
|
|||||||
|
// #docplaster
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
|
||||||
import { Observable, of } from 'rxjs';
|
export function docRegionObserver(console) {
|
||||||
|
// #docregion observer
|
||||||
|
|
||||||
// #docregion observer
|
// Create simple observable that emits three values
|
||||||
|
const myObservable = of(1, 2, 3);
|
||||||
|
|
||||||
// Create simple observable that emits three values
|
// Create observer object
|
||||||
const myObservable = of(1, 2, 3);
|
const myObserver = {
|
||||||
|
|
||||||
// Create observer object
|
|
||||||
const myObserver = {
|
|
||||||
next: x => console.log('Observer got a next value: ' + x),
|
next: x => console.log('Observer got a next value: ' + x),
|
||||||
error: err => console.error('Observer got an error: ' + err),
|
error: err => console.error('Observer got an error: ' + err),
|
||||||
complete: () => console.log('Observer got a complete notification'),
|
complete: () => console.log('Observer got a complete notification'),
|
||||||
};
|
};
|
||||||
|
|
||||||
// Execute with the observer object
|
// Execute with the observer object
|
||||||
myObservable.subscribe(myObserver);
|
myObservable.subscribe(myObserver);
|
||||||
// Logs:
|
|
||||||
// Observer got a next value: 1
|
|
||||||
// Observer got a next value: 2
|
|
||||||
// Observer got a next value: 3
|
|
||||||
// Observer got a complete notification
|
|
||||||
|
|
||||||
// #enddocregion observer
|
// Logs:
|
||||||
|
// Observer got a next value: 1
|
||||||
|
// Observer got a next value: 2
|
||||||
|
// Observer got a next value: 3
|
||||||
|
// Observer got a complete notification
|
||||||
|
|
||||||
// #docregion sub_fn
|
// #enddocregion observer
|
||||||
myObservable.subscribe(
|
|
||||||
|
// #docregion sub_fn
|
||||||
|
myObservable.subscribe(
|
||||||
x => console.log('Observer got a next value: ' + x),
|
x => console.log('Observer got a next value: ' + x),
|
||||||
err => console.error('Observer got an error: ' + err),
|
err => console.error('Observer got an error: ' + err),
|
||||||
() => console.log('Observer got a complete notification')
|
() => console.log('Observer got a complete notification')
|
||||||
);
|
);
|
||||||
// #enddocregion sub_fn
|
// #enddocregion sub_fn
|
||||||
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"cmd": "yarn",
|
"cmd": "yarn",
|
||||||
"args": [ "tsc", "--project", "./tsconfig.app.json" ]
|
"args": ["tsc", "--project", "tsconfig.spec.json", "--module", "commonjs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmd": "yarn",
|
||||||
|
"args": ["jasmine", "out-tsc/**/*.spec.js"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,70 @@
|
|||||||
|
import { interval } from 'rxjs';
|
||||||
|
import { tap } from 'rxjs/operators';
|
||||||
|
import { backoff } from './backoff';
|
||||||
|
|
||||||
|
describe('backoff()', () => {
|
||||||
|
beforeEach(() => jasmine.clock().install());
|
||||||
|
afterEach(() => jasmine.clock().uninstall());
|
||||||
|
|
||||||
|
it('should retry in case of error', () => {
|
||||||
|
const mockConsole = {log: jasmine.createSpy('log')};
|
||||||
|
const source = interval(10).pipe(
|
||||||
|
tap(i => {
|
||||||
|
if (i > 0) {
|
||||||
|
throw new Error('Test error');
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
backoff(3, 100),
|
||||||
|
);
|
||||||
|
source.subscribe({
|
||||||
|
next: v => mockConsole.log(`Emitted: ${v}`),
|
||||||
|
error: e => mockConsole.log(`Errored: ${e.message || e}`),
|
||||||
|
complete: () => mockConsole.log('Completed'),
|
||||||
|
});
|
||||||
|
|
||||||
|
// Initial try:
|
||||||
|
// Errors on second emission and schedules retrying (with delay).
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
mockConsole.log.calls.reset();
|
||||||
|
|
||||||
|
// First re-attempt after 100ms:
|
||||||
|
// Errors again on second emission and schedules retrying (with larger delay).
|
||||||
|
jasmine.clock().tick(100);
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
mockConsole.log.calls.reset();
|
||||||
|
|
||||||
|
// Second re-attempt after 400ms:
|
||||||
|
// Errors again on second emission and schedules retrying (with even larger delay).
|
||||||
|
jasmine.clock().tick(400);
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
mockConsole.log.calls.reset();
|
||||||
|
|
||||||
|
// Third re-attempt after 900ms:
|
||||||
|
// Errors again on second emission and gives up (no retrying).
|
||||||
|
jasmine.clock().tick(900);
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Emitted: 0']]);
|
||||||
|
mockConsole.log.calls.reset();
|
||||||
|
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([['Errored: Test error']]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,23 +1,32 @@
|
|||||||
|
// #docplaster
|
||||||
import { pipe, range, timer, zip } from 'rxjs';
|
// #docregion
|
||||||
|
import { of, pipe, range, throwError, timer, zip } from 'rxjs';
|
||||||
import { ajax } from 'rxjs/ajax';
|
import { ajax } from 'rxjs/ajax';
|
||||||
import { retryWhen, map, mergeMap } from 'rxjs/operators';
|
import { map, mergeMap, retryWhen } from 'rxjs/operators';
|
||||||
|
|
||||||
function backoff(maxTries, ms) {
|
export function backoff(maxTries, delay) {
|
||||||
return pipe(
|
return pipe(
|
||||||
retryWhen(attempts => zip(range(1, maxTries), attempts)
|
retryWhen(attempts =>
|
||||||
.pipe(
|
zip(range(1, maxTries + 1), attempts).pipe(
|
||||||
map(([i]) => i * i),
|
mergeMap(([i, err]) => (i > maxTries) ? throwError(err) : of(i)),
|
||||||
mergeMap(i => timer(i * ms))
|
map(i => i * i),
|
||||||
)
|
mergeMap(v => timer(v * delay)),
|
||||||
)
|
),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #enddocregion
|
||||||
|
/*
|
||||||
|
This function declaration is necessary to ensure that it does not get called
|
||||||
|
when running the unit tests. It will not get rendered into the docs.
|
||||||
|
The indentation needs to start in the leftmost level position as well because of how
|
||||||
|
the docplaster combines the different regions together.
|
||||||
|
*/
|
||||||
|
function docRegionAjaxCall() {
|
||||||
|
// #docregion
|
||||||
ajax('/api/endpoint')
|
ajax('/api/endpoint')
|
||||||
.pipe(backoff(3, 250))
|
.pipe(backoff(3, 250))
|
||||||
.subscribe(data => handleData(data));
|
.subscribe(function handleData(data) { /* ... */ });
|
||||||
|
// #enddocregion
|
||||||
function handleData(data) {
|
|
||||||
// ...
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,72 @@
|
|||||||
|
import { of } from 'rxjs';
|
||||||
|
import { docRegionTypeahead } from './typeahead';
|
||||||
|
|
||||||
|
describe('typeahead', () => {
|
||||||
|
let document;
|
||||||
|
let ajax;
|
||||||
|
let triggertInputChange;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
jasmine.clock().install();
|
||||||
|
const input = {
|
||||||
|
addEventListener: jasmine
|
||||||
|
.createSpy('addEvent')
|
||||||
|
.and.callFake((eventName: string, cb: (e) => void) => {
|
||||||
|
if (eventName === 'input') {
|
||||||
|
triggertInputChange = cb;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
removeEventListener: jasmine.createSpy('removeEvent'),
|
||||||
|
};
|
||||||
|
|
||||||
|
document = { getElementById: (id: string) => input };
|
||||||
|
ajax = jasmine.createSpy('ajax').and.callFake((url: string) => of('foo bar'));
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
jasmine.clock().uninstall();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should make an ajax call to the corrent endpoint', () => {
|
||||||
|
docRegionTypeahead(document, ajax);
|
||||||
|
triggertInputChange({ target: { value: 'foo' } });
|
||||||
|
jasmine.clock().tick(11);
|
||||||
|
expect(ajax).toHaveBeenCalledWith('/api/endpoint?search=foo');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not make an ajax call, when the input length < 3', () => {
|
||||||
|
docRegionTypeahead(document, ajax);
|
||||||
|
triggertInputChange({ target: { value: '' } });
|
||||||
|
jasmine.clock().tick(11);
|
||||||
|
expect(ajax).not.toHaveBeenCalled();
|
||||||
|
triggertInputChange({ target: { value: 'fo' } });
|
||||||
|
jasmine.clock().tick(11);
|
||||||
|
expect(ajax).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not make an ajax call for intermediate values when debouncing', () => {
|
||||||
|
docRegionTypeahead(document, ajax);
|
||||||
|
triggertInputChange({ target: { value: 'foo' } });
|
||||||
|
jasmine.clock().tick(9);
|
||||||
|
triggertInputChange({ target: { value: 'bar' } });
|
||||||
|
jasmine.clock().tick(9);
|
||||||
|
triggertInputChange({ target: { value: 'baz' } });
|
||||||
|
jasmine.clock().tick(9);
|
||||||
|
triggertInputChange({ target: { value: 'qux' } });
|
||||||
|
expect(ajax).not.toHaveBeenCalled();
|
||||||
|
jasmine.clock().tick(10);
|
||||||
|
expect(ajax).toHaveBeenCalledTimes(1);
|
||||||
|
expect(ajax).toHaveBeenCalledWith('/api/endpoint?search=qux');
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should not make an ajax call, when the input value has not changed', () => {
|
||||||
|
docRegionTypeahead(document, ajax);
|
||||||
|
triggertInputChange({ target: { value: 'foo' } });
|
||||||
|
jasmine.clock().tick(11);
|
||||||
|
expect(ajax).toHaveBeenCalled();
|
||||||
|
ajax.calls.reset();
|
||||||
|
triggertInputChange({ target: { value: 'foo' } });
|
||||||
|
jasmine.clock().tick(11);
|
||||||
|
expect(ajax).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
@ -1,18 +1,32 @@
|
|||||||
import { fromEvent } from 'rxjs';
|
/*
|
||||||
import { ajax } from 'rxjs/ajax';
|
Because of how the code is merged together using the doc regions,
|
||||||
import { debounceTime, distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators';
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
// #docplaster
|
||||||
|
// #docregion
|
||||||
|
import { fromEvent } from 'rxjs';
|
||||||
|
import { ajax } from 'rxjs/ajax';
|
||||||
|
import { debounceTime, distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators';
|
||||||
|
|
||||||
|
// #enddocregion
|
||||||
|
/* tslint:disable:no-shadowed-variable */
|
||||||
|
/* tslint:disable:align */
|
||||||
|
export function docRegionTypeahead(document, ajax) {
|
||||||
|
// #docregion
|
||||||
|
const searchBox = document.getElementById('search-box');
|
||||||
|
|
||||||
const searchBox = document.getElementById('search-box');
|
const typeahead = fromEvent(searchBox, 'input').pipe(
|
||||||
|
|
||||||
const typeahead = fromEvent(searchBox, 'input').pipe(
|
|
||||||
map((e: KeyboardEvent) => (e.target as HTMLInputElement).value),
|
map((e: KeyboardEvent) => (e.target as HTMLInputElement).value),
|
||||||
filter(text => text.length > 2),
|
filter(text => text.length > 2),
|
||||||
debounceTime(10),
|
debounceTime(10),
|
||||||
distinctUntilChanged(),
|
distinctUntilChanged(),
|
||||||
switchMap(() => ajax('/api/endpoint'))
|
switchMap(searchTerm => ajax(`/api/endpoint?search=${searchTerm}`))
|
||||||
);
|
);
|
||||||
|
|
||||||
typeahead.subscribe(data => {
|
typeahead.subscribe(data => {
|
||||||
// Handle the data from the API
|
// Handle the data from the API
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// #enddocregion
|
||||||
|
return typeahead;
|
||||||
|
}
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
"tests": [
|
"tests": [
|
||||||
{
|
{
|
||||||
"cmd": "yarn",
|
"cmd": "yarn",
|
||||||
"args": [ "tsc", "--project", "./tsconfig.app.json" ]
|
"args": ["tsc", "--project", "tsconfig.spec.json", "--module", "commonjs"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"cmd": "yarn",
|
||||||
|
"args": ["jasmine", "out-tsc/**/*.spec.js"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
46
aio/content/examples/rx-library/src/error-handling.spec.ts
Normal file
46
aio/content/examples/rx-library/src/error-handling.spec.ts
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
import { Subject, throwError } from 'rxjs';
|
||||||
|
import { docRegionDefault } from './error-handling';
|
||||||
|
|
||||||
|
describe('error-handling', () => {
|
||||||
|
let mockConsole;
|
||||||
|
let ajaxSubject;
|
||||||
|
let ajax;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
mockConsole = {log: jasmine.createSpy('log')};
|
||||||
|
ajaxSubject = new Subject();
|
||||||
|
ajax = jasmine
|
||||||
|
.createSpy('ajax')
|
||||||
|
.and.callFake((url: string) => ajaxSubject);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => ajaxSubject.unsubscribe());
|
||||||
|
|
||||||
|
it('should return the response object', () => {
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
|
||||||
|
ajaxSubject.next({response: {foo: 'bar'}});
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['data: ', {foo: 'bar'}]
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an empty array when using an object without a `response` property', () => {
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
|
||||||
|
ajaxSubject.next({foo: 'bar'});
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['data: ', []]
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an empty array when the ajax observable errors', () => {
|
||||||
|
ajax.and.returnValue(throwError('Test Error'));
|
||||||
|
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['data: ', []]
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,25 +1,36 @@
|
|||||||
|
// #docplaster
|
||||||
import { of } from 'rxjs';
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:no-shadowed-variable */
|
||||||
|
/* tslint:disable:align */
|
||||||
// #docregion
|
// #docregion
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import { ajax } from 'rxjs/ajax';
|
||||||
|
import { map, catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ajax } from 'rxjs/ajax';
|
// #enddocregion
|
||||||
import { map, catchError } from 'rxjs/operators';
|
|
||||||
// Return "response" from the API. If an error happens,
|
export function docRegionDefault(console, ajax) {
|
||||||
// return an empty array.
|
// #docregion
|
||||||
const apiData = ajax('/api/data').pipe(
|
// Return "response" from the API. If an error happens,
|
||||||
map(res => {
|
// return an empty array.
|
||||||
|
const apiData = ajax('/api/data').pipe(
|
||||||
|
map((res: any) => {
|
||||||
if (!res.response) {
|
if (!res.response) {
|
||||||
throw new Error('Value expected!');
|
throw new Error('Value expected!');
|
||||||
}
|
}
|
||||||
return res.response;
|
return res.response;
|
||||||
}),
|
}),
|
||||||
catchError(err => of([]))
|
catchError(err => of([]))
|
||||||
);
|
);
|
||||||
|
|
||||||
apiData.subscribe({
|
apiData.subscribe({
|
||||||
next(x) { console.log('data: ', x); },
|
next(x) { console.log('data: ', x); },
|
||||||
error(err) { console.log('errors already caught... will not run'); }
|
error(err) { console.log('errors already caught... will not run'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
return apiData;
|
||||||
|
}
|
||||||
|
14
aio/content/examples/rx-library/src/operators.1.spec.ts
Normal file
14
aio/content/examples/rx-library/src/operators.1.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { docRegionDefault } from './operators.1';
|
||||||
|
|
||||||
|
describe('squareOdd - operators.1.ts', () => {
|
||||||
|
it('should return square odds', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
docRegionDefault(console);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(3);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[1],
|
||||||
|
[9],
|
||||||
|
[25],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,23 +1,30 @@
|
|||||||
import { of, pipe } from 'rxjs';
|
// #docplaster
|
||||||
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
// #docregion
|
// #docregion
|
||||||
|
import { of, pipe } from 'rxjs';
|
||||||
import { filter, map } from 'rxjs/operators';
|
import { filter, map } from 'rxjs/operators';
|
||||||
|
|
||||||
const nums = of(1, 2, 3, 4, 5);
|
|
||||||
|
|
||||||
// Create a function that accepts an Observable.
|
|
||||||
const squareOddVals = pipe(
|
|
||||||
filter((n: number) => n % 2 !== 0),
|
|
||||||
map(n => n * n)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create an Observable that will run the filter and map functions
|
|
||||||
const squareOdd = squareOddVals(nums);
|
|
||||||
|
|
||||||
// Subscribe to run the combined functions
|
|
||||||
squareOdd.subscribe(x => console.log(x));
|
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
export function docRegionDefault(console) {
|
||||||
|
// #docregion
|
||||||
|
const nums = of(1, 2, 3, 4, 5);
|
||||||
|
|
||||||
|
// Create a function that accepts an Observable.
|
||||||
|
const squareOddVals = pipe(
|
||||||
|
filter((n: number) => n % 2 !== 0),
|
||||||
|
map(n => n * n)
|
||||||
|
);
|
||||||
|
|
||||||
|
// Create an Observable that will run the filter and map functions
|
||||||
|
const squareOdd = squareOddVals(nums);
|
||||||
|
|
||||||
|
// Subscribe to run the combined functions
|
||||||
|
squareOdd.subscribe(x => console.log(x));
|
||||||
|
|
||||||
|
// #enddocregion
|
||||||
|
}
|
||||||
|
14
aio/content/examples/rx-library/src/operators.2.spec.ts
Normal file
14
aio/content/examples/rx-library/src/operators.2.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { docRegionDefault } from './operators.2';
|
||||||
|
|
||||||
|
describe('squareOdd - operators.2.ts', () => {
|
||||||
|
it('should return square odds', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
docRegionDefault(console);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(3);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[1],
|
||||||
|
[9],
|
||||||
|
[25],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,16 +1,25 @@
|
|||||||
import { Observable, of } from 'rxjs';
|
// #docplaster
|
||||||
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
// #docregion
|
// #docregion
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import { filter, map } from 'rxjs/operators';
|
||||||
|
|
||||||
import { filter, map } from 'rxjs/operators';
|
// #enddocregion
|
||||||
|
|
||||||
const squareOdd = of(1, 2, 3, 4, 5)
|
export function docRegionDefault(console) {
|
||||||
|
// #docregion
|
||||||
|
const squareOdd = of(1, 2, 3, 4, 5)
|
||||||
.pipe(
|
.pipe(
|
||||||
filter(n => n % 2 !== 0),
|
filter(n => n % 2 !== 0),
|
||||||
map(n => n * n)
|
map(n => n * n)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Subscribe to get values
|
// Subscribe to get values
|
||||||
squareOdd.subscribe(x => console.log(x));
|
squareOdd.subscribe(x => console.log(x));
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
}
|
||||||
|
14
aio/content/examples/rx-library/src/operators.spec.ts
Normal file
14
aio/content/examples/rx-library/src/operators.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { docRegionDefault } from './operators';
|
||||||
|
|
||||||
|
describe('squaredNums - operators.ts', () => {
|
||||||
|
it('should return square odds', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
docRegionDefault(console);
|
||||||
|
expect(console.log).toHaveBeenCalledTimes(3);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[1],
|
||||||
|
[4],
|
||||||
|
[9],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,20 +1,28 @@
|
|||||||
|
// #docplaster
|
||||||
import { Observable, of } from 'rxjs';
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
// #docregion
|
// #docregion
|
||||||
|
import { of } from 'rxjs';
|
||||||
import { map } from 'rxjs/operators';
|
import { map } from 'rxjs/operators';
|
||||||
|
|
||||||
const nums = of(1, 2, 3);
|
|
||||||
|
|
||||||
const squareValues = map((val: number) => val * val);
|
|
||||||
const squaredNums = squareValues(nums);
|
|
||||||
|
|
||||||
squaredNums.subscribe(x => console.log(x));
|
|
||||||
|
|
||||||
// Logs
|
|
||||||
// 1
|
|
||||||
// 4
|
|
||||||
// 9
|
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
|
||||||
|
export function docRegionDefault(console) {
|
||||||
|
// #docregion
|
||||||
|
const nums = of(1, 2, 3);
|
||||||
|
|
||||||
|
const squareValues = map((val: number) => val * val);
|
||||||
|
const squaredNums = squareValues(nums);
|
||||||
|
|
||||||
|
squaredNums.subscribe(x => console.log(x));
|
||||||
|
|
||||||
|
// Logs
|
||||||
|
// 1
|
||||||
|
// 4
|
||||||
|
// 9
|
||||||
|
|
||||||
|
// #enddocregion
|
||||||
|
}
|
||||||
|
69
aio/content/examples/rx-library/src/retry-on-error.spec.ts
Normal file
69
aio/content/examples/rx-library/src/retry-on-error.spec.ts
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
import { of, throwError } from 'rxjs';
|
||||||
|
import { mergeMap, tap } from 'rxjs/operators';
|
||||||
|
import { docRegionDefault } from './retry-on-error';
|
||||||
|
|
||||||
|
describe('retry-on-error', () => {
|
||||||
|
let mockConsole;
|
||||||
|
beforeEach(() => mockConsole = { log: jasmine.createSpy('log') });
|
||||||
|
|
||||||
|
it('should return the response object', () => {
|
||||||
|
const ajax = () => of({ response: { foo: 'bar' } });
|
||||||
|
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['data: ', { foo: 'bar' }],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an empty array after 3 retries + 1 initial request', () => {
|
||||||
|
const ajax = () => {
|
||||||
|
return of({ noresponse: true }).pipe(tap(() => mockConsole.log('Subscribed to AJAX')));
|
||||||
|
};
|
||||||
|
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['Subscribed to AJAX'],
|
||||||
|
['Error occured.'],
|
||||||
|
['Subscribed to AJAX'],
|
||||||
|
['Error occured.'],
|
||||||
|
['Subscribed to AJAX'],
|
||||||
|
['Error occured.'],
|
||||||
|
['Subscribed to AJAX'],
|
||||||
|
['Error occured.'],
|
||||||
|
['data: ', []],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return the response if the request succeeds upon retrying', () => {
|
||||||
|
// Fail on the first two requests, but succeed from the 3rd onwards.
|
||||||
|
let failCount = 2;
|
||||||
|
const ajax = () => of(null).pipe(
|
||||||
|
tap(() => mockConsole.log('Subscribed to AJAX')),
|
||||||
|
// Fail on the first 2 requests, but succeed from the 3rd onwards.
|
||||||
|
mergeMap(() => {
|
||||||
|
if (failCount > 0) {
|
||||||
|
failCount--;
|
||||||
|
return throwError('Test error');
|
||||||
|
}
|
||||||
|
return of({ response: { foo: 'bar' } });
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['Subscribed to AJAX'], // Initial request | 1st attempt overall
|
||||||
|
['Subscribed to AJAX'], // 1st retry attempt | 2nd attempt overall
|
||||||
|
['Subscribed to AJAX'], // 2nd retry attempt | 3rd attempt overall
|
||||||
|
['data: ', { foo: 'bar' }],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should return an empty array when the ajax observable throws an error', () => {
|
||||||
|
const ajax = () => throwError('Test Error');
|
||||||
|
|
||||||
|
docRegionDefault(mockConsole, ajax);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['data: ', []],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
@ -1,26 +1,35 @@
|
|||||||
|
// #docplaster
|
||||||
import { Observable, of } from 'rxjs';
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:no-shadowed-variable */
|
||||||
|
/* tslint:disable:align */
|
||||||
// #docregion
|
// #docregion
|
||||||
|
import { of } from 'rxjs';
|
||||||
|
import { ajax } from 'rxjs/ajax';
|
||||||
|
import { map, retry, catchError } from 'rxjs/operators';
|
||||||
|
|
||||||
import { ajax } from 'rxjs/ajax';
|
// #enddocregion
|
||||||
import { map, retry, catchError } from 'rxjs/operators';
|
|
||||||
|
|
||||||
const apiData = ajax('/api/data').pipe(
|
export function docRegionDefault(console, ajax) {
|
||||||
retry(3), // Retry up to 3 times before failing
|
// #docregion
|
||||||
map(res => {
|
const apiData = ajax('/api/data').pipe(
|
||||||
|
map((res: any) => {
|
||||||
if (!res.response) {
|
if (!res.response) {
|
||||||
|
console.log('Error occured.');
|
||||||
throw new Error('Value expected!');
|
throw new Error('Value expected!');
|
||||||
}
|
}
|
||||||
return res.response;
|
return res.response;
|
||||||
}),
|
}),
|
||||||
|
retry(3), // Retry up to 3 times before failing
|
||||||
catchError(err => of([]))
|
catchError(err => of([]))
|
||||||
);
|
);
|
||||||
|
|
||||||
apiData.subscribe({
|
apiData.subscribe({
|
||||||
next(x) { console.log('data: ', x); },
|
next(x) { console.log('data: ', x); },
|
||||||
error(err) { console.log('errors already caught... will not run'); }
|
error(err) { console.log('errors already caught... will not run'); }
|
||||||
});
|
});
|
||||||
|
|
||||||
// #enddocregion
|
// #enddocregion
|
||||||
|
}
|
||||||
|
@ -0,0 +1,14 @@
|
|||||||
|
import { of } from 'rxjs';
|
||||||
|
import { docRegionPromise } from './simple-creation.1';
|
||||||
|
|
||||||
|
describe('simple-creation.1', () => {
|
||||||
|
it('should create a promise from an observable and return an empty object', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
const fetch = () => of({foo: 42});
|
||||||
|
docRegionPromise(console, fetch);
|
||||||
|
expect(console.log.calls.allArgs()).toEqual([
|
||||||
|
[{foo: 42}],
|
||||||
|
['Completed'],
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
});
|
24
aio/content/examples/rx-library/src/simple-creation.1.ts
Normal file
24
aio/content/examples/rx-library/src/simple-creation.1.ts
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
// #docplaster
|
||||||
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
|
// #docregion promise
|
||||||
|
import { from } from 'rxjs';
|
||||||
|
|
||||||
|
// #enddocregion promise
|
||||||
|
|
||||||
|
export function docRegionPromise(console, fetch) {
|
||||||
|
// #docregion promise
|
||||||
|
// Create an Observable out of a promise
|
||||||
|
const data = from(fetch('/api/endpoint'));
|
||||||
|
// Subscribe to begin listening for async result
|
||||||
|
data.subscribe({
|
||||||
|
next(response) { console.log(response); },
|
||||||
|
error(err) { console.error('Error: ' + err); },
|
||||||
|
complete() { console.log('Completed'); }
|
||||||
|
});
|
||||||
|
|
||||||
|
// #enddocregion promise
|
||||||
|
}
|
@ -0,0 +1,21 @@
|
|||||||
|
import { docRegionInterval } from './simple-creation.2';
|
||||||
|
|
||||||
|
describe('simple-creation.2', () => {
|
||||||
|
beforeEach(() => jasmine.clock().install());
|
||||||
|
afterEach(() => jasmine.clock().uninstall());
|
||||||
|
|
||||||
|
it('should create an Observable that will publish a value on an interval', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
const subscription = docRegionInterval(console);
|
||||||
|
jasmine.clock().tick(1000);
|
||||||
|
expect(console.log).toHaveBeenCalledWith('It\'s been 1 seconds since subscribing!');
|
||||||
|
console.log.calls.reset();
|
||||||
|
|
||||||
|
jasmine.clock().tick(999);
|
||||||
|
expect(console.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
jasmine.clock().tick(1);
|
||||||
|
expect(console.log).toHaveBeenCalledWith('It\'s been 2 seconds since subscribing!');
|
||||||
|
subscription.unsubscribe();
|
||||||
|
});
|
||||||
|
});
|
22
aio/content/examples/rx-library/src/simple-creation.2.ts
Normal file
22
aio/content/examples/rx-library/src/simple-creation.2.ts
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
// #docplaster
|
||||||
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
|
// #docregion interval
|
||||||
|
import { interval } from 'rxjs';
|
||||||
|
|
||||||
|
// #enddocregion interval
|
||||||
|
|
||||||
|
export function docRegionInterval(console) {
|
||||||
|
// #docregion interval
|
||||||
|
// Create an Observable that will publish a value on an interval
|
||||||
|
const secondsCounter = interval(1000);
|
||||||
|
// Subscribe to begin publishing values
|
||||||
|
const subscription = secondsCounter.subscribe(n =>
|
||||||
|
console.log(`It's been ${n + 1} seconds since subscribing!`));
|
||||||
|
|
||||||
|
// #enddocregion interval
|
||||||
|
return subscription;
|
||||||
|
}
|
@ -0,0 +1,53 @@
|
|||||||
|
import { docRegionEvent } from './simple-creation.3';
|
||||||
|
|
||||||
|
describe('simple-creation.3', () => {
|
||||||
|
let triggerMousemove;
|
||||||
|
let mockConsole;
|
||||||
|
let input;
|
||||||
|
let mockDocument;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
mockConsole = {log: jasmine.createSpy('log')};
|
||||||
|
input = {
|
||||||
|
addEventListener: jasmine
|
||||||
|
.createSpy('addEventListener')
|
||||||
|
.and.callFake((eventName, cb) => {
|
||||||
|
if (eventName === 'mousemove') {
|
||||||
|
triggerMousemove = cb;
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
removeEventListener: jasmine.createSpy('removeEventListener'),
|
||||||
|
};
|
||||||
|
mockDocument = { getElementById: () => input };
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should log coords when subscribing', () => {
|
||||||
|
docRegionEvent(mockConsole, mockDocument);
|
||||||
|
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
triggerMousemove({ clientX: 50, clientY: 50 });
|
||||||
|
triggerMousemove({ clientX: 30, clientY: 50 });
|
||||||
|
triggerMousemove({ clientX: 50, clientY: 30 });
|
||||||
|
expect(mockConsole.log).toHaveBeenCalledTimes(3);
|
||||||
|
expect(mockConsole.log.calls.allArgs()).toEqual([
|
||||||
|
['Coords: 50 X 50'],
|
||||||
|
['Coords: 30 X 50'],
|
||||||
|
['Coords: 50 X 30']
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call unsubscribe when clientX and clientY are below < 40 ', () => {
|
||||||
|
docRegionEvent(mockConsole, mockDocument);
|
||||||
|
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
|
||||||
|
// Ensure that we have unsubscribed.
|
||||||
|
triggerMousemove({ clientX: 30, clientY: 30 });
|
||||||
|
expect(input.removeEventListener).toHaveBeenCalledWith('mousemove', triggerMousemove, undefined);
|
||||||
|
mockConsole.log.calls.reset();
|
||||||
|
|
||||||
|
triggerMousemove({ clientX: 50, clientY: 50 });
|
||||||
|
expect(mockConsole.log).not.toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
});
|
32
aio/content/examples/rx-library/src/simple-creation.3.ts
Normal file
32
aio/content/examples/rx-library/src/simple-creation.3.ts
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
// #docplaster
|
||||||
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
|
/* tslint:disable:align */
|
||||||
|
// #docregion event
|
||||||
|
import { fromEvent } from 'rxjs';
|
||||||
|
|
||||||
|
// #enddocregion event
|
||||||
|
|
||||||
|
export function docRegionEvent(console, document) {
|
||||||
|
// #docregion event
|
||||||
|
const el = document.getElementById('my-element');
|
||||||
|
|
||||||
|
// Create an Observable that will publish mouse movements
|
||||||
|
const mouseMoves = fromEvent(el, 'mousemove');
|
||||||
|
|
||||||
|
// Subscribe to start listening for mouse-move events
|
||||||
|
const subscription = mouseMoves.subscribe((evt: MouseEvent) => {
|
||||||
|
// Log coords of mouse movements
|
||||||
|
console.log(`Coords: ${evt.clientX} X ${evt.clientY}`);
|
||||||
|
|
||||||
|
// When the mouse is over the upper-left of the screen,
|
||||||
|
// unsubscribe to stop listening for mouse movements
|
||||||
|
if (evt.clientX < 40 && evt.clientY < 40) {
|
||||||
|
subscription.unsubscribe();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// #enddocregion event
|
||||||
|
}
|
14
aio/content/examples/rx-library/src/simple-creation.spec.ts
Normal file
14
aio/content/examples/rx-library/src/simple-creation.spec.ts
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
import { of } from 'rxjs';
|
||||||
|
import { docRegionAjax } from './simple-creation';
|
||||||
|
|
||||||
|
describe('ajax', () => {
|
||||||
|
it('should make a request and console log the status and response', () => {
|
||||||
|
const console = {log: jasmine.createSpy('log')};
|
||||||
|
const ajax = jasmine.createSpy('ajax').and.callFake((url: string) => {
|
||||||
|
return of({status: 200, response: 'foo bar'});
|
||||||
|
});
|
||||||
|
|
||||||
|
docRegionAjax(console, ajax);
|
||||||
|
expect(console.log).toHaveBeenCalledWith(200, 'foo bar');
|
||||||
|
});
|
||||||
|
});
|
@ -1,65 +1,19 @@
|
|||||||
|
// #docplaster
|
||||||
// #docregion promise
|
/*
|
||||||
|
Because of how the code is merged together using the doc regions,
|
||||||
import { from } from 'rxjs';
|
we need to indent the imports with the function below.
|
||||||
|
*/
|
||||||
// Create an Observable out of a promise
|
/* tslint:disable:no-shadowed-variable */
|
||||||
const data = from(fetch('/api/endpoint'));
|
/* tslint:disable:align */
|
||||||
// Subscribe to begin listening for async result
|
|
||||||
data.subscribe({
|
|
||||||
next(response) { console.log(response); },
|
|
||||||
error(err) { console.error('Error: ' + err); },
|
|
||||||
complete() { console.log('Completed'); }
|
|
||||||
});
|
|
||||||
|
|
||||||
// #enddocregion promise
|
|
||||||
|
|
||||||
// #docregion interval
|
|
||||||
|
|
||||||
import { interval } from 'rxjs';
|
|
||||||
|
|
||||||
// Create an Observable that will publish a value on an interval
|
|
||||||
const secondsCounter = interval(1000);
|
|
||||||
// Subscribe to begin publishing values
|
|
||||||
secondsCounter.subscribe(n =>
|
|
||||||
console.log(`It's been ${n} seconds since subscribing!`));
|
|
||||||
|
|
||||||
// #enddocregion interval
|
|
||||||
|
|
||||||
|
|
||||||
// #docregion event
|
|
||||||
|
|
||||||
import { fromEvent } from 'rxjs';
|
|
||||||
|
|
||||||
const el = document.getElementById('my-element');
|
|
||||||
|
|
||||||
// Create an Observable that will publish mouse movements
|
|
||||||
const mouseMoves = fromEvent(el, 'mousemove');
|
|
||||||
|
|
||||||
// Subscribe to start listening for mouse-move events
|
|
||||||
const subscription = mouseMoves.subscribe((evt: MouseEvent) => {
|
|
||||||
// Log coords of mouse movements
|
|
||||||
console.log(`Coords: ${evt.clientX} X ${evt.clientY}`);
|
|
||||||
|
|
||||||
// When the mouse is over the upper-left of the screen,
|
|
||||||
// unsubscribe to stop listening for mouse movements
|
|
||||||
if (evt.clientX < 40 && evt.clientY < 40) {
|
|
||||||
subscription.unsubscribe();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// #enddocregion event
|
|
||||||
|
|
||||||
|
|
||||||
// #docregion ajax
|
// #docregion ajax
|
||||||
|
import { ajax } from 'rxjs/ajax';
|
||||||
import { ajax } from 'rxjs/ajax';
|
|
||||||
|
|
||||||
// Create an Observable that will create an AJAX request
|
// Create an Observable that will create an AJAX request
|
||||||
const apiData = ajax('/api/data');
|
|
||||||
// Subscribe to create the request
|
|
||||||
apiData.subscribe(res => console.log(res.status, res.response));
|
|
||||||
|
|
||||||
// #enddocregion ajax
|
// #enddocregion ajax
|
||||||
|
export function docRegionAjax(console, ajax) {
|
||||||
|
// #docregion ajax
|
||||||
|
const apiData = ajax('/api/data');
|
||||||
|
// Subscribe to create the request
|
||||||
|
apiData.subscribe(res => console.log(res.status, res.response));
|
||||||
|
// #enddocregion ajax
|
||||||
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
import { Injectable } from '@angular/core';
|
||||||
|
import { SwUpdate } from '@angular/service-worker';
|
||||||
|
|
||||||
|
function notifyUser(message: string): void { }
|
||||||
|
|
||||||
|
// #docregion sw-unrecoverable-state
|
||||||
|
@Injectable()
|
||||||
|
export class HandleUnrecoverableStateService {
|
||||||
|
constructor(updates: SwUpdate) {
|
||||||
|
updates.unrecoverable.subscribe(event => {
|
||||||
|
notifyUser(
|
||||||
|
`An error occurred that we cannot recover from:\n${event.reason}\n\n` +
|
||||||
|
'Please reload the page.');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// #enddocregion sw-unrecoverable-state
|
@ -10,8 +10,8 @@ import { Hero } from '../shared/hero.model';
|
|||||||
template: `
|
template: `
|
||||||
<section>
|
<section>
|
||||||
Our list of heroes:
|
Our list of heroes:
|
||||||
<hero-profile *ngFor="let hero of heroes" [hero]="hero">
|
<toh-hero *ngFor="let hero of heroes" [hero]="hero">
|
||||||
</hero-profile>
|
</toh-hero>
|
||||||
Total powers: {{totalPowers}}<br>
|
Total powers: {{totalPowers}}<br>
|
||||||
Average power: {{totalPowers / heroes.length}}
|
Average power: {{totalPowers / heroes.length}}
|
||||||
</section>
|
</section>
|
||||||
|
@ -28,7 +28,7 @@ import {
|
|||||||
ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync
|
ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync
|
||||||
} from '@angular/core/testing';
|
} from '@angular/core/testing';
|
||||||
|
|
||||||
import { addMatchers, newEvent, click } from '../../testing';
|
import { addMatchers, click } from '../../testing';
|
||||||
|
|
||||||
export class NotProvided extends ValueService { /* example below */ }
|
export class NotProvided extends ValueService { /* example below */ }
|
||||||
beforeEach(addMatchers);
|
beforeEach(addMatchers);
|
||||||
@ -274,9 +274,11 @@ describe('demo (with TestBed):', () => {
|
|||||||
expect(comp.name).toBe(expectedOrigName,
|
expect(comp.name).toBe(expectedOrigName,
|
||||||
`comp.name should still be ${expectedOrigName} after value change, before binding happens`);
|
`comp.name should still be ${expectedOrigName} after value change, before binding happens`);
|
||||||
|
|
||||||
// dispatch a DOM event so that Angular learns of input value change.
|
// Dispatch a DOM event so that Angular learns of input value change.
|
||||||
// then wait while ngModel pushes input.box value to comp.name
|
// then wait while ngModel pushes input.box value to comp.name
|
||||||
input.dispatchEvent(newEvent('input'));
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
input.dispatchEvent(new Event('input'));
|
||||||
return fixture.whenStable();
|
return fixture.whenStable();
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
@ -312,9 +314,11 @@ describe('demo (with TestBed):', () => {
|
|||||||
expect(comp.name).toBe(expectedOrigName,
|
expect(comp.name).toBe(expectedOrigName,
|
||||||
`comp.name should still be ${expectedOrigName} after value change, before binding happens`);
|
`comp.name should still be ${expectedOrigName} after value change, before binding happens`);
|
||||||
|
|
||||||
// dispatch a DOM event so that Angular learns of input value change.
|
// Dispatch a DOM event so that Angular learns of input value change.
|
||||||
// then wait a tick while ngModel pushes input.box value to comp.name
|
// then wait a tick while ngModel pushes input.box value to comp.name
|
||||||
input.dispatchEvent(newEvent('input'));
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
input.dispatchEvent(new Event('input'));
|
||||||
tick();
|
tick();
|
||||||
expect(comp.name).toBe(expectedNewName,
|
expect(comp.name).toBe(expectedNewName,
|
||||||
`After ngModel updates the model, comp.name should be ${expectedNewName} `);
|
`After ngModel updates the model, comp.name should be ${expectedNewName} `);
|
||||||
@ -335,10 +339,12 @@ describe('demo (with TestBed):', () => {
|
|||||||
// simulate user entering new name in input
|
// simulate user entering new name in input
|
||||||
input.value = inputText;
|
input.value = inputText;
|
||||||
|
|
||||||
// dispatch a DOM event so that Angular learns of input value change.
|
// Dispatch a DOM event so that Angular learns of input value change.
|
||||||
// then wait a tick while ngModel pushes input.box value to comp.text
|
// then wait a tick while ngModel pushes input.box value to comp.text
|
||||||
// and Angular updates the output span
|
// and Angular updates the output span
|
||||||
input.dispatchEvent(newEvent('input'));
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
input.dispatchEvent(new Event('input'));
|
||||||
tick();
|
tick();
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
expect(span.textContent).toBe(expectedText, 'output span');
|
expect(span.textContent).toBe(expectedText, 'output span');
|
||||||
|
@ -3,7 +3,7 @@ import { ComponentFixture, fakeAsync, inject, TestBed, tick, waitForAsync } from
|
|||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
ActivatedRoute, ActivatedRouteStub, asyncData, click, newEvent
|
ActivatedRoute, ActivatedRouteStub, asyncData, click
|
||||||
} from '../../testing';
|
} from '../../testing';
|
||||||
|
|
||||||
import { Hero } from '../model/hero';
|
import { Hero } from '../model/hero';
|
||||||
@ -99,7 +99,10 @@ function overrideSetup() {
|
|||||||
const newName = 'New Name';
|
const newName = 'New Name';
|
||||||
|
|
||||||
page.nameInput.value = newName;
|
page.nameInput.value = newName;
|
||||||
page.nameInput.dispatchEvent(newEvent('input')); // tell Angular
|
|
||||||
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
page.nameInput.dispatchEvent(new Event('input')); // tell Angular
|
||||||
|
|
||||||
expect(component.hero.name).toBe(newName, 'component hero has new name');
|
expect(component.hero.name).toBe(newName, 'component hero has new name');
|
||||||
expect(hdsSpy.testHero.name).toBe(origName, 'service hero unchanged before save');
|
expect(hdsSpy.testHero.name).toBe(origName, 'service hero unchanged before save');
|
||||||
@ -197,9 +200,10 @@ function heroModuleSetup() {
|
|||||||
// simulate user entering a new name into the input box
|
// simulate user entering a new name into the input box
|
||||||
nameInput.value = 'quick BROWN fOx';
|
nameInput.value = 'quick BROWN fOx';
|
||||||
|
|
||||||
// dispatch a DOM event so that Angular learns of input value change.
|
// Dispatch a DOM event so that Angular learns of input value change.
|
||||||
// use newEvent utility function (not provided by Angular) for better browser compatibility
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
nameInput.dispatchEvent(newEvent('input'));
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
nameInput.dispatchEvent(new Event('input'));
|
||||||
|
|
||||||
// Tell Angular to update the display binding through the title pipe
|
// Tell Angular to update the display binding through the title pipe
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
@ -6,7 +6,7 @@ import { DebugElement } from '@angular/core';
|
|||||||
|
|
||||||
import { Router } from '@angular/router';
|
import { Router } from '@angular/router';
|
||||||
|
|
||||||
import { addMatchers, newEvent } from '../../testing';
|
import { addMatchers } from '../../testing';
|
||||||
import { HeroService } from '../model/hero.service';
|
import { HeroService } from '../model/hero.service';
|
||||||
import { getTestHeroes, TestHeroService } from '../model/testing/test-hero.service';
|
import { getTestHeroes, TestHeroService } from '../model/testing/test-hero.service';
|
||||||
|
|
||||||
@ -53,7 +53,10 @@ describe('HeroListComponent', () => {
|
|||||||
it('should select hero on click', fakeAsync(() => {
|
it('should select hero on click', fakeAsync(() => {
|
||||||
const expectedHero = HEROES[1];
|
const expectedHero = HEROES[1];
|
||||||
const li = page.heroRows[1];
|
const li = page.heroRows[1];
|
||||||
li.dispatchEvent(newEvent('click'));
|
|
||||||
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
li.dispatchEvent(new Event('click'));
|
||||||
tick();
|
tick();
|
||||||
// `.toEqual` because selectedHero is clone of expectedHero; see FakeHeroService
|
// `.toEqual` because selectedHero is clone of expectedHero; see FakeHeroService
|
||||||
expect(comp.selectedHero).toEqual(expectedHero);
|
expect(comp.selectedHero).toEqual(expectedHero);
|
||||||
@ -62,7 +65,10 @@ describe('HeroListComponent', () => {
|
|||||||
it('should navigate to selected hero detail on click', fakeAsync(() => {
|
it('should navigate to selected hero detail on click', fakeAsync(() => {
|
||||||
const expectedHero = HEROES[1];
|
const expectedHero = HEROES[1];
|
||||||
const li = page.heroRows[1];
|
const li = page.heroRows[1];
|
||||||
li.dispatchEvent(newEvent('click'));
|
|
||||||
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
li.dispatchEvent(new Event('click'));
|
||||||
tick();
|
tick();
|
||||||
|
|
||||||
// should have navigated
|
// should have navigated
|
||||||
|
@ -3,7 +3,6 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|||||||
import { By } from '@angular/platform-browser';
|
import { By } from '@angular/platform-browser';
|
||||||
|
|
||||||
import { HighlightDirective } from './highlight.directive';
|
import { HighlightDirective } from './highlight.directive';
|
||||||
import { newEvent } from '../../testing';
|
|
||||||
|
|
||||||
// #docregion test-component
|
// #docregion test-component
|
||||||
@Component({
|
@Component({
|
||||||
@ -59,9 +58,12 @@ describe('HighlightDirective', () => {
|
|||||||
const input = des[2].nativeElement as HTMLInputElement;
|
const input = des[2].nativeElement as HTMLInputElement;
|
||||||
expect(input.style.backgroundColor).toBe('cyan', 'initial backgroundColor');
|
expect(input.style.backgroundColor).toBe('cyan', 'initial backgroundColor');
|
||||||
|
|
||||||
// dispatch a DOM event so that Angular responds to the input value change.
|
|
||||||
input.value = 'green';
|
input.value = 'green';
|
||||||
input.dispatchEvent(newEvent('input'));
|
|
||||||
|
// Dispatch a DOM event so that Angular responds to the input value change.
|
||||||
|
// In older browsers, such as IE, you might need a CustomEvent instead. See
|
||||||
|
// https://developer.mozilla.org/en-US/docs/Web/API/CustomEvent/CustomEvent#Polyfill
|
||||||
|
input.dispatchEvent(new Event('input'));
|
||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
|
|
||||||
expect(input.style.backgroundColor).toBe('green', 'changed backgroundColor');
|
expect(input.style.backgroundColor).toBe('green', 'changed backgroundColor');
|
||||||
|
@ -14,18 +14,6 @@ export function advance(f: ComponentFixture<any>): void {
|
|||||||
f.detectChanges();
|
f.detectChanges();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Create custom DOM event the old fashioned way
|
|
||||||
*
|
|
||||||
* https://developer.mozilla.org/en-US/docs/Web/API/Event/initEvent
|
|
||||||
* Although officially deprecated, some browsers (phantom) don't accept the preferred "new Event(eventName)"
|
|
||||||
*/
|
|
||||||
export function newEvent(eventName: string, bubbles = false, cancelable = false) {
|
|
||||||
const evt = document.createEvent('CustomEvent'); // MUST be 'CustomEvent'
|
|
||||||
evt.initCustomEvent(eventName, bubbles, cancelable, null);
|
|
||||||
return evt;
|
|
||||||
}
|
|
||||||
|
|
||||||
// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
// See https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/button
|
||||||
// #docregion click-event
|
// #docregion click-event
|
||||||
/** Button events to pass to `DebugElement.triggerEventHandler` for RouterLink event handler */
|
/** Button events to pass to `DebugElement.triggerEventHandler` for RouterLink event handler */
|
||||||
|
@ -1,5 +1,8 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint:recommended",
|
"extends": "tslint:recommended",
|
||||||
|
"rulesDirectory": [
|
||||||
|
"codelyzer"
|
||||||
|
],
|
||||||
"rules": {
|
"rules": {
|
||||||
"align": {
|
"align": {
|
||||||
"options": [
|
"options": [
|
||||||
@ -13,22 +16,6 @@
|
|||||||
"deprecation": {
|
"deprecation": {
|
||||||
"severity": "warning"
|
"severity": "warning"
|
||||||
},
|
},
|
||||||
"component-class-suffix": true,
|
|
||||||
"component-selector": [
|
|
||||||
true,
|
|
||||||
"element",
|
|
||||||
// TODO: Fix the code and change the prefix to `"app"` (or whatever makes sense).
|
|
||||||
"",
|
|
||||||
"kebab-case"
|
|
||||||
],
|
|
||||||
"contextual-lifecycle": true,
|
|
||||||
"directive-class-suffix": true,
|
|
||||||
"directive-selector": [
|
|
||||||
true,
|
|
||||||
"attribute",
|
|
||||||
["app", "toh"],
|
|
||||||
"camelCase"
|
|
||||||
],
|
|
||||||
"eofline": true,
|
"eofline": true,
|
||||||
"import-blacklist": [
|
"import-blacklist": [
|
||||||
true,
|
true,
|
||||||
@ -56,6 +43,8 @@
|
|||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
// TODO(gkalpak): Fix the code and enable this.
|
||||||
|
// "no-any": true,
|
||||||
"no-console": [
|
"no-console": [
|
||||||
true,
|
true,
|
||||||
"debug",
|
"debug",
|
||||||
@ -95,6 +84,11 @@
|
|||||||
"named": "never"
|
"named": "never"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
// TODO(gkalpak): Fix the code and enable this.
|
||||||
|
// "typedef": [
|
||||||
|
// true,
|
||||||
|
// "call-signature"
|
||||||
|
// ],
|
||||||
"typedef-whitespace": {
|
"typedef-whitespace": {
|
||||||
"options": [
|
"options": [
|
||||||
{
|
{
|
||||||
@ -130,6 +124,9 @@
|
|||||||
"check-typecast"
|
"check-typecast"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"component-class-suffix": true,
|
||||||
|
"contextual-lifecycle": true,
|
||||||
|
"directive-class-suffix": true,
|
||||||
"no-conflicting-lifecycle": true,
|
"no-conflicting-lifecycle": true,
|
||||||
"no-host-metadata-property": true,
|
"no-host-metadata-property": true,
|
||||||
"no-input-rename": true,
|
"no-input-rename": true,
|
||||||
@ -141,9 +138,19 @@
|
|||||||
"template-banana-in-box": true,
|
"template-banana-in-box": true,
|
||||||
"template-no-negated-async": true,
|
"template-no-negated-async": true,
|
||||||
"use-lifecycle-interface": true,
|
"use-lifecycle-interface": true,
|
||||||
"use-pipe-transform-interface": true
|
"use-pipe-transform-interface": true,
|
||||||
},
|
"directive-selector": [
|
||||||
"rulesDirectory": [
|
true,
|
||||||
"codelyzer"
|
"attribute",
|
||||||
|
["app", "toh"],
|
||||||
|
"camelCase"
|
||||||
|
],
|
||||||
|
"component-selector": [
|
||||||
|
true,
|
||||||
|
"element",
|
||||||
|
// TODO: Fix the code and change the prefix to `"app"` (or whatever makes sense).
|
||||||
|
"",
|
||||||
|
"kebab-case"
|
||||||
]
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
import * as angular from 'angular';
|
import * as angular from 'angular';
|
||||||
import 'angular-route';
|
import 'angular-route';
|
||||||
|
|
||||||
const appName = 'myApp';
|
const appModule = angular.module('myApp', [
|
||||||
|
|
||||||
angular.module(appName, [
|
|
||||||
'ngRoute'
|
'ngRoute'
|
||||||
])
|
])
|
||||||
.config(['$routeProvider', '$locationProvider',
|
.config(['$routeProvider', '$locationProvider',
|
||||||
@ -25,5 +23,5 @@ angular.module(appName, [
|
|||||||
);
|
);
|
||||||
|
|
||||||
export function bootstrap(el: HTMLElement) {
|
export function bootstrap(el: HTMLElement) {
|
||||||
return angular.bootstrap(el, [appName]);
|
return angular.bootstrap(el, [appModule.name]);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ In the following example, the `@Component()` metadata object and the class const
|
|||||||
@Component({
|
@Component({
|
||||||
selector: 'app-typical',
|
selector: 'app-typical',
|
||||||
template: '<div>A typical component for {{data.name}}</div>'
|
template: '<div>A typical component for {{data.name}}</div>'
|
||||||
)}
|
})
|
||||||
export class TypicalComponent {
|
export class TypicalComponent {
|
||||||
@Input() data: TypicalData;
|
@Input() data: TypicalData;
|
||||||
constructor(private someService: SomeService) { ... }
|
constructor(private someService: SomeService) { ... }
|
||||||
|
@ -95,7 +95,7 @@ or in the `@NgModule()` or `@Component()` metadata
|
|||||||
Registering the provider in the `@Injectable()` metadata also allows Angular to optimize an app
|
Registering the provider in the `@Injectable()` metadata also allows Angular to optimize an app
|
||||||
by removing the service from the compiled app if it isn't used.
|
by removing the service from the compiled app if it isn't used.
|
||||||
|
|
||||||
* When you register a provider with a [specific NgModule](guide/architecture-modules), the same instance of a service is available to all components in that NgModule. To register at this level, use the `providers` property of the `@NgModule()` decorator,
|
* When you register a provider with a [specific NgModule](guide/architecture-modules), the same instance of a service is available to all components in that NgModule. To register at this level, use the `providers` property of the `@NgModule()` decorator.
|
||||||
|
|
||||||
```
|
```
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
@ -18,8 +18,6 @@ When you use the [Angular CLI](cli) command `ng new` to generate an app, the def
|
|||||||
/* JavaScript imports */
|
/* JavaScript imports */
|
||||||
import { BrowserModule } from '@angular/platform-browser';
|
import { BrowserModule } from '@angular/platform-browser';
|
||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { FormsModule } from '@angular/forms';
|
|
||||||
import { HttpClientModule } from '@angular/common/http';
|
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
|
|
||||||
@ -29,9 +27,7 @@ import { AppComponent } from './app.component';
|
|||||||
AppComponent
|
AppComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
BrowserModule,
|
BrowserModule
|
||||||
FormsModule,
|
|
||||||
HttpClientModule
|
|
||||||
],
|
],
|
||||||
providers: [],
|
providers: [],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
@ -120,9 +116,6 @@ Now you could use your `ItemDirective` in a component. This example uses `AppMod
|
|||||||
|
|
||||||
Remember, components, directives, and pipes belong to one module only. You only need to declare them once in your app because you share them by importing the necessary modules. This saves you time and helps keep your app lean.
|
Remember, components, directives, and pipes belong to one module only. You only need to declare them once in your app because you share them by importing the necessary modules. This saves you time and helps keep your app lean.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{@a imports}
|
{@a imports}
|
||||||
|
|
||||||
## The `imports` array
|
## The `imports` array
|
||||||
@ -130,6 +123,12 @@ Remember, components, directives, and pipes belong to one module only. You only
|
|||||||
The module's `imports` array appears exclusively in the `@NgModule` metadata object.
|
The module's `imports` array appears exclusively in the `@NgModule` metadata object.
|
||||||
It tells Angular about other NgModules that this particular module needs to function properly.
|
It tells Angular about other NgModules that this particular module needs to function properly.
|
||||||
|
|
||||||
|
<code-example
|
||||||
|
path="bootstrapping/src/app/app.module.ts"
|
||||||
|
region="imports"
|
||||||
|
header="src/app/app.module.ts (excerpt)">
|
||||||
|
</code-example>
|
||||||
|
|
||||||
This list of modules are those that export components, directives, or pipes
|
This list of modules are those that export components, directives, or pipes
|
||||||
that component templates in this module reference. In this case, the component is
|
that component templates in this module reference. In this case, the component is
|
||||||
`AppComponent`, which references components, directives, or pipes in `BrowserModule`,
|
`AppComponent`, which references components, directives, or pipes in `BrowserModule`,
|
||||||
@ -138,6 +137,8 @@ A component template can reference another component, directive,
|
|||||||
or pipe when the referenced class is declared in this module or
|
or pipe when the referenced class is declared in this module or
|
||||||
the class was imported from another module.
|
the class was imported from another module.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
{@a bootstrap-array}
|
{@a bootstrap-array}
|
||||||
|
|
||||||
## The `providers` array
|
## The `providers` array
|
||||||
|
@ -53,18 +53,7 @@ Angular supports most recent browsers. This includes the following specific vers
|
|||||||
IE
|
IE
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div> 11, 10*, 9* ("compatibility view" mode not supported) </div>
|
<div>11</div>
|
||||||
<div>*deprecated in v10, see the {@link guide/deprecations#ie-9-10-and-mobile deprecations guide}.</div>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
IE Mobile*
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
11
|
|
||||||
<div>*deprecated in v10, see the {@link guide/deprecations#ie-9-10-and-mobile deprecations guide}.</div>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -185,7 +174,7 @@ These are the polyfills required to run an Angular application on each supported
|
|||||||
|
|
||||||
<td>
|
<td>
|
||||||
Chrome, Firefox, Edge, <br>
|
Chrome, Firefox, Edge, <br>
|
||||||
Safari, Android, IE 10+
|
Safari, Android, IE 11
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
@ -196,20 +185,6 @@ These are the polyfills required to run an Angular application on each supported
|
|||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr style="vertical-align: top">
|
|
||||||
|
|
||||||
<td>
|
|
||||||
IE 9
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
ES2015<br>[classList](guide/browser-support#classlist)
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
@ -272,30 +247,7 @@ Some features of Angular may require additional polyfills.
|
|||||||
</td>
|
</td>
|
||||||
|
|
||||||
<td>
|
<td>
|
||||||
IE 10, IE 11
|
IE 11
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr style="vertical-align: top">
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Http](guide/http) when sending and receiving binary data
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
[Typed Array](guide/browser-support#typedarray)<br>
|
|
||||||
|
|
||||||
[Blob](guide/browser-support#blob)<br>
|
|
||||||
|
|
||||||
[FormData](guide/browser-support#formdata)
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
IE 9
|
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
@ -437,60 +389,6 @@ The following polyfills are used to test the framework itself. They are a good s
|
|||||||
|
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<a id='typedarray' href="https://github.com/inexorabletash/polyfill/blob/master/typedarray.js">Typed Array</a>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
MIT
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
4KB
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<a id='blob' href="https://github.com/eligrey/Blob.js">Blob</a>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
MIT
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
1.3KB
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
<tr>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
|
|
||||||
<a id='formdata' href="https://github.com/francois2metz/html5-formdata">FormData</a>
|
|
||||||
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
MIT
|
|
||||||
</td>
|
|
||||||
|
|
||||||
<td>
|
|
||||||
0.4KB
|
|
||||||
</td>
|
|
||||||
|
|
||||||
</tr>
|
|
||||||
|
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@ Emulated is the default and most commonly used view encapsulation. For more info
|
|||||||
|
|
||||||
<div class="alert is-important">
|
<div class="alert is-important">
|
||||||
|
|
||||||
The shadow-piercing descendant combinator is deprecated and [support is being removed from major browsers](https://www.chromestatus.com/features/6750456638341120) and tools.
|
The shadow-piercing descendant combinator is deprecated and [support is being removed from major browsers](https://www.chromestatus.com/feature/6750456638341120) and tools.
|
||||||
As such we plan to drop support in Angular (for all 3 of `/deep/`, `>>>` and `::ng-deep`).
|
As such we plan to drop support in Angular (for all 3 of `/deep/`, `>>>` and `::ng-deep`).
|
||||||
Until then `::ng-deep` should be preferred for a broader compatibility with the tools.
|
Until then `::ng-deep` should be preferred for a broader compatibility with the tools.
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ The `ng generate` command creates the `projects/my-lib` folder in your workspace
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
When you generate a new library, the workspace configuration file, `angular.json`, is updated with a project of type 'library'.
|
When you generate a new library, the workspace configuration file, `angular.json`, is updated with a project of type `library`.
|
||||||
|
|
||||||
<code-example format="json">
|
<code-example format="json">
|
||||||
"projects": {
|
"projects": {
|
||||||
@ -109,7 +109,7 @@ If you want a dropdown that would contain different passed-in values each time,
|
|||||||
|
|
||||||
Suppose you want to read a configuration file and then generate a form based on that configuration.
|
Suppose you want to read a configuration file and then generate a form based on that configuration.
|
||||||
If that form will need additional customization by the developer who is using your library, it might work best as a schematic.
|
If that form will need additional customization by the developer who is using your library, it might work best as a schematic.
|
||||||
However, if the forms will always be the same and not need much customization by developers, then you could create a dynamic component that takes the configuration and generates the form.
|
However, if the form will always be the same and not need much customization by developers, then you could create a dynamic component that takes the configuration and generates the form.
|
||||||
In general, the more complex the customization, the more useful the schematic approach.
|
In general, the more complex the customization, the more useful the schematic approach.
|
||||||
|
|
||||||
To learn more, see [Schematics Overview](guide/schematics) and [Schematics for Libraries](guide/schematics-for-libraries).
|
To learn more, see [Schematics Overview](guide/schematics) and [Schematics for Libraries](guide/schematics-for-libraries).
|
||||||
|
@ -387,7 +387,7 @@ List the generated bundles in the `dist/` folder.
|
|||||||
|
|
||||||
<code-example language="none" class="code-shell">
|
<code-example language="none" class="code-shell">
|
||||||
|
|
||||||
ls dist/*.bundle.js
|
ls dist/*.js
|
||||||
|
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
@ -396,7 +396,7 @@ The following example displays the graph for the _main_ bundle.
|
|||||||
|
|
||||||
<code-example language="none" class="code-shell">
|
<code-example language="none" class="code-shell">
|
||||||
|
|
||||||
node_modules/.bin/source-map-explorer dist/main.*.bundle.js
|
node_modules/.bin/source-map-explorer dist/main*
|
||||||
|
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
@ -511,9 +511,9 @@ Each script tag has a `type="module"` or `nomodule` attribute. Browsers with nat
|
|||||||
|
|
||||||
To include differential loading in your application builds, you must configure the Browserslist and TypeScript configuration files in your application project.
|
To include differential loading in your application builds, you must configure the Browserslist and TypeScript configuration files in your application project.
|
||||||
|
|
||||||
The following examples show a `browserlistrc` and `tsconfig.json` file for a newly created Angular application. In this configuration, legacy browsers such as IE 9-11 are ignored, and the compilation target is ES2015.
|
The following examples show a `.browserslistrc` and `tsconfig.json` file for a newly created Angular application. In this configuration, legacy browsers such as IE 9-11 are ignored, and the compilation target is ES2015.
|
||||||
|
|
||||||
<code-example language="none" header="browserslistrc">
|
<code-example language="none" header=".browserslistrc">
|
||||||
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
# This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
|
||||||
# For additional information regarding the format and rule options, please see:
|
# For additional information regarding the format and rule options, please see:
|
||||||
# https://github.com/browserslist/browserslist#queries
|
# https://github.com/browserslist/browserslist#queries
|
||||||
@ -527,7 +527,7 @@ The following examples show a `browserlistrc` and `tsconfig.json` file for a new
|
|||||||
last 1 Chrome version
|
last 1 Chrome version
|
||||||
last 1 Firefox version
|
last 1 Firefox version
|
||||||
last 2 Edge major versions
|
last 2 Edge major versions
|
||||||
last 2 Safari major version
|
last 2 Safari major versions
|
||||||
last 2 iOS major versions
|
last 2 iOS major versions
|
||||||
Firefox ESR
|
Firefox ESR
|
||||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||||
|
@ -38,7 +38,6 @@ v9 - v12
|
|||||||
| `@angular/bazel` | [`Bazel builder and schematics`](#bazelbuilder) | v10 |
|
| `@angular/bazel` | [`Bazel builder and schematics`](#bazelbuilder) | v10 |
|
||||||
| `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | <!--v8--> v11 |
|
| `@angular/common` | [`ReflectiveInjector`](#reflectiveinjector) | <!--v8--> v11 |
|
||||||
| `@angular/common` | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | <!--v9--> v11 |
|
| `@angular/common` | [`CurrencyPipe` - `DEFAULT_CURRENCY_CODE`](api/common/CurrencyPipe#currency-code-deprecation) | <!--v9--> v11 |
|
||||||
| `@angular/core` | [`CollectionChangeRecord`](#core) | <!--v7--> v11 |
|
|
||||||
| `@angular/core` | [`DefaultIterableDiffer`](#core) | <!--v7--> v11 |
|
| `@angular/core` | [`DefaultIterableDiffer`](#core) | <!--v7--> v11 |
|
||||||
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v11 |
|
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v11 |
|
||||||
| `@angular/core` | [`RenderComponentType`](#core) | <!--v7--> v11 |
|
| `@angular/core` | [`RenderComponentType`](#core) | <!--v7--> v11 |
|
||||||
@ -49,7 +48,6 @@ v9 - v12
|
|||||||
| `@angular/upgrade` | [`@angular/upgrade`](#upgrade) | <!--v8--> v11 |
|
| `@angular/upgrade` | [`@angular/upgrade`](#upgrade) | <!--v8--> v11 |
|
||||||
| `@angular/upgrade` | [`getAngularLib`](#upgrade-static) | <!--v8--> v11 |
|
| `@angular/upgrade` | [`getAngularLib`](#upgrade-static) | <!--v8--> v11 |
|
||||||
| `@angular/upgrade` | [`setAngularLib`](#upgrade-static) | <!--v8--> v11 |
|
| `@angular/upgrade` | [`setAngularLib`](#upgrade-static) | <!--v8--> v11 |
|
||||||
| `@angular/platform-webworker` | [All entry points](api/platform-webworker) | <!--v8--> v11 |
|
|
||||||
| template syntax | [`<template`>](#template-tag) | <!--v7--> v11 |
|
| template syntax | [`<template`>](#template-tag) | <!--v7--> v11 |
|
||||||
| polyfills | [reflect-metadata](#reflect-metadata) | <!--v8--> v11 |
|
| polyfills | [reflect-metadata](#reflect-metadata) | <!--v8--> v11 |
|
||||||
| npm package format | [`esm5` and `fesm5` entry-points in @angular/* npm packages](guide/deprecations#esm5-fesm5) | <!-- v9 --> v11 |
|
| npm package format | [`esm5` and `fesm5` entry-points in @angular/* npm packages](guide/deprecations#esm5-fesm5) | <!-- v9 --> v11 |
|
||||||
@ -61,7 +59,6 @@ v9 - v12
|
|||||||
| `@angular/core/testing` | [`async`](#testing) | <!--v9--> v12 |
|
| `@angular/core/testing` | [`async`](#testing) | <!--v9--> v12 |
|
||||||
| `@angular/router` | [`ActivatedRoute` params and `queryParams` properties](#activatedroute-props) | unspecified |
|
| `@angular/router` | [`ActivatedRoute` params and `queryParams` properties](#activatedroute-props) | unspecified |
|
||||||
| template syntax | [`/deep/`, `>>>`, and `::ng-deep`](#deep-component-style-selector) | <!--v7--> unspecified |
|
| template syntax | [`/deep/`, `>>>`, and `::ng-deep`](#deep-component-style-selector) | <!--v7--> unspecified |
|
||||||
| browser support | [`IE 9 and 10, IE mobile`](#ie-9-10-and-mobile) | <!--v10--> v11 |
|
|
||||||
|
|
||||||
For information about Angular CDK and Angular Material deprecations, see the [changelog](https://github.com/angular/components/blob/master/CHANGELOG.md).
|
For information about Angular CDK and Angular Material deprecations, see the [changelog](https://github.com/angular/components/blob/master/CHANGELOG.md).
|
||||||
|
|
||||||
@ -89,7 +86,6 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
|
|||||||
|
|
||||||
| API | Replacement | Deprecation announced | Notes |
|
| API | Replacement | Deprecation announced | Notes |
|
||||||
| --- | ----------- | --------------------- | ----- |
|
| --- | ----------- | --------------------- | ----- |
|
||||||
| [`CollectionChangeRecord`](api/core/CollectionChangeRecord) | [`IterableChangeRecord`](api/core/IterableChangeRecord) | v4 | none |
|
|
||||||
| [`DefaultIterableDiffer`](api/core/DefaultIterableDiffer) | n/a | v4 | Not part of public API. |
|
| [`DefaultIterableDiffer`](api/core/DefaultIterableDiffer) | n/a | v4 | Not part of public API. |
|
||||||
| [`ReflectiveInjector`](api/core/ReflectiveInjector) | [`Injector.create`](api/core/Injector#create) | v5 | See [`ReflectiveInjector`](#reflectiveinjector) |
|
| [`ReflectiveInjector`](api/core/ReflectiveInjector) | [`Injector.create`](api/core/Injector#create) | v5 | See [`ReflectiveInjector`](#reflectiveinjector) |
|
||||||
| [`ReflectiveKey`](api/core/ReflectiveKey) | none | v5 | none |
|
| [`ReflectiveKey`](api/core/ReflectiveKey) | none | v5 | none |
|
||||||
@ -124,21 +120,7 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
|
|||||||
|
|
||||||
| API | Replacement | Deprecation announced | Notes |
|
| API | Replacement | Deprecation announced | Notes |
|
||||||
| --- | ----------- | --------------------- | ----- |
|
| --- | ----------- | --------------------- | ----- |
|
||||||
| [`preserveQueryParams`](api/router/NavigationExtras#preserveQueryParams) | [`queryParamsHandling`](api/router/NavigationExtras#queryParamsHandling) | v4 | none |
|
| [`preserveQueryParams`](api/router/UrlCreationOptions#preserveQueryParams) | [`queryParamsHandling`](api/router/UrlCreationOptions#queryParamsHandling) | v4 | none |
|
||||||
|
|
||||||
{@a platform-webworker}
|
|
||||||
### @angular/platform-webworker
|
|
||||||
|
|
||||||
| API | Replacement | Deprecation announced | Notes |
|
|
||||||
| --- | ----------- | --------------------- | ----- |
|
|
||||||
| [All entry points](api/platform-webworker) | none | v8 | See [platform-webworker](#webworker-apps). |
|
|
||||||
|
|
||||||
{@a platform-webworker-dynamic}
|
|
||||||
### @angular/platform-webworker-dynamic
|
|
||||||
|
|
||||||
| API | Replacement | Deprecation announced | Notes |
|
|
||||||
| --- | ----------- | --------------------- | ----- |
|
|
||||||
| [All entry points](api/platform-webworker-dynamic) | none | v8 | See [platform-webworker](#webworker-apps). |
|
|
||||||
|
|
||||||
{@a upgrade}
|
{@a upgrade}
|
||||||
### @angular/upgrade
|
### @angular/upgrade
|
||||||
@ -394,28 +376,6 @@ These two properties have subtle differences, so switching to `textContent` unde
|
|||||||
|
|
||||||
All of the `wtf*` APIs are deprecated and will be removed in a future version.
|
All of the `wtf*` APIs are deprecated and will be removed in a future version.
|
||||||
|
|
||||||
{@a webworker-apps}
|
|
||||||
### Running Angular applications in platform-webworker
|
|
||||||
|
|
||||||
The `@angular/platform-*` packages enable Angular to be run in different contexts. For examples,
|
|
||||||
`@angular/platform-server` enables Angular to be run on the server, and `@angular/platform-browser`
|
|
||||||
enables Angular to be run in a web browser.
|
|
||||||
|
|
||||||
`@angular/platform-webworker` was introduced in Angular version 2 as an experiment in leveraging
|
|
||||||
Angular's rendering architecture to run an entire web application in a
|
|
||||||
[web worker](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API). We've learned a lot
|
|
||||||
from this experiment and have come to the conclusion that running the entire application in a web
|
|
||||||
worker is not the best strategy for most applications.
|
|
||||||
|
|
||||||
Going forward, we will focus our efforts related to web workers around their primary use case of
|
|
||||||
offloading CPU-intensive, non-critical work needed for initial rendering (such as in-memory search
|
|
||||||
and image processing). Learn more in the
|
|
||||||
[guide to Using Web Workers with the Angular CLI](guide/web-worker).
|
|
||||||
|
|
||||||
As of Angular version 8, all `platform-webworker` APIs are deprecated.
|
|
||||||
This includes both packages: `@angular/platform-webworker` and
|
|
||||||
`@angular/platform-webworker-dynamic`.
|
|
||||||
|
|
||||||
{@a entryComponents}
|
{@a entryComponents}
|
||||||
### `entryComponents` and `ANALYZE_FOR_ENTRY_COMPONENTS` no longer required
|
### `entryComponents` and `ANALYZE_FOR_ENTRY_COMPONENTS` no longer required
|
||||||
Previously, the `entryComponents` array in the `NgModule` definition was used to tell the compiler which components would be created and inserted dynamically. With Ivy, this isn't a requirement anymore and the `entryComponents` array can be removed from existing module declarations. The same applies to the `ANALYZE_FOR_ENTRY_COMPONENTS` injection token.
|
Previously, the `entryComponents` array in the `NgModule` definition was used to tell the compiler which components would be created and inserted dynamically. With Ivy, this isn't a requirement anymore and the `entryComponents` array can be removed from existing module declarations. The same applies to the `ANALYZE_FOR_ENTRY_COMPONENTS` injection token.
|
||||||
@ -464,20 +424,6 @@ export class MyModule {
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
{@a ie-9-10-and-mobile}
|
|
||||||
### IE 9, 10, and IE mobile support
|
|
||||||
|
|
||||||
Support for IE 9 and 10 has been deprecated, as well as support for IE Mobile. These will be dropped in a future version.
|
|
||||||
Supporting outdated browsers like these increases bundle size, code complexity, and test load, and also requires time and effort that could be spent on improvements to the framework.
|
|
||||||
For example, fixing issues can be more difficult, as a straightforward fix for modern browsers could break old ones that have quirks due to not receiving updates from vendors.
|
|
||||||
|
|
||||||
The final decision was made on three key points:
|
|
||||||
* __Vendor support__: Microsoft dropped support of IE 9 and 10 on 1/12/16, meaning they no longer provide security updates or technical support. Additionally, Microsoft dropped support for Windows 10 Mobile in December 2019.
|
|
||||||
* __Usage statistics__: We looked at usage trends for IE 9 and 10 (as well as IE Mobile) from various sources and all indicated that usage percentages were extremely small (fractions of 1%).
|
|
||||||
* __Feedback from partners__: We also reached out to some of our Angular customers and none expressed concern about dropping IE 9, 10, nor IE Mobile support.
|
|
||||||
|
|
||||||
|
|
||||||
{@a wrapped-value}
|
{@a wrapped-value}
|
||||||
### `WrappedValue`
|
### `WrappedValue`
|
||||||
|
|
||||||
@ -603,18 +549,6 @@ In practical terms, the `package.json` of all `@angular` packages has changed in
|
|||||||
|
|
||||||
For more information about the npm package format, see the [Angular Package Format spec](https://goo.gl/jB3GVv).
|
For more information about the npm package format, see the [Angular Package Format spec](https://goo.gl/jB3GVv).
|
||||||
|
|
||||||
{@a removed}
|
|
||||||
## Removed APIs
|
|
||||||
|
|
||||||
The following APIs have been removed starting with version 10.0.0*:
|
|
||||||
|
|
||||||
| Package | API | Replacement | Notes |
|
|
||||||
| ---------------- | -------------- | ----------- | ----- |
|
|
||||||
| `@angular/core` | Undecorated base classes that use Angular features | Add Angular decorator | See [migration guide](guide/migration-undecorated-classes) for more info |
|
|
||||||
| `@angular/core` | `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | See [migration guide](guide/migration-module-with-providers) for more info |
|
|
||||||
|
|
||||||
*To see APIs removed in version 9, check out this guide on the [version 9 docs site](https://v9.angular.io/guide/deprecations#removed).
|
|
||||||
|
|
||||||
{@a style-sanitization}
|
{@a style-sanitization}
|
||||||
### Style Sanitization for `[style]` and `[style.prop]` bindings
|
### Style Sanitization for `[style]` and `[style.prop]` bindings
|
||||||
Angular used to sanitize `[style]` and `[style.prop]` bindings to prevent malicious code from being inserted through `javascript:` expressions in CSS `url()` entries. However, most modern browsers no longer support the usage of these expressions, so sanitization was only maintained for the sake of IE 6 and 7. Given that Angular does not support either IE 6 or 7 and sanitization has a performance cost, we will no longer sanitize style bindings as of version 10 of Angular.
|
Angular used to sanitize `[style]` and `[style.prop]` bindings to prevent malicious code from being inserted through `javascript:` expressions in CSS `url()` entries. However, most modern browsers no longer support the usage of these expressions, so sanitization was only maintained for the sake of IE 6 and 7. Given that Angular does not support either IE 6 or 7 and sanitization has a performance cost, we will no longer sanitize style bindings as of version 10 of Angular.
|
||||||
|
@ -119,7 +119,14 @@ The recently-developed [custom elements](https://developer.mozilla.org/en-US/doc
|
|||||||
|
|
||||||
In browsers that support Custom Elements natively, the specification requires developers use ES2015 classes to define Custom Elements - developers can opt-in to this by setting the `target: "es2015"` property in their project's [TypeScript configuration file](/guide/typescript-configuration). As Custom Element and ES2015 support may not be available in all browsers, developers can instead choose to use a polyfill to support older browsers and ES5 code.
|
In browsers that support Custom Elements natively, the specification requires developers use ES2015 classes to define Custom Elements - developers can opt-in to this by setting the `target: "es2015"` property in their project's [TypeScript configuration file](/guide/typescript-configuration). As Custom Element and ES2015 support may not be available in all browsers, developers can instead choose to use a polyfill to support older browsers and ES5 code.
|
||||||
|
|
||||||
Use the [Angular CLI](cli) to automatically set up your project with the correct polyfill: `ng add @angular/elements --project=*your_project_name*`.
|
Use the [Angular CLI](cli) to automatically set up your project with the correct polyfill:
|
||||||
|
|
||||||
|
<code-example language="sh">
|
||||||
|
|
||||||
|
ng add @angular/elements --project=*your_project_name*
|
||||||
|
|
||||||
|
</code-example>
|
||||||
|
|
||||||
- For more information about polyfills, see [polyfill documentation](https://www.webcomponents.org/polyfills).
|
- For more information about polyfills, see [polyfill documentation](https://www.webcomponents.org/polyfills).
|
||||||
|
|
||||||
- For more information about Angular browser support, see [Browser Support](guide/browser-support).
|
- For more information about Angular browser support, see [Browser Support](guide/browser-support).
|
||||||
|
@ -76,6 +76,12 @@ All router components must be entry components. Because this would require you t
|
|||||||
|
|
||||||
## The `entryComponents` array
|
## The `entryComponents` array
|
||||||
|
|
||||||
|
<div class="alert is-helpful">
|
||||||
|
|
||||||
|
Since 9.0.0 with Ivy, the `entryComponents` property is no longer necessary. See [deprecations guide](guide/deprecations#entryComponents).
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
Though the `@NgModule` decorator has an `entryComponents` array, most of the time
|
Though the `@NgModule` decorator has an `entryComponents` array, most of the time
|
||||||
you won't have to explicitly set any entry components because Angular adds components listed in `@NgModule.bootstrap` and those in route definitions to entry components automatically. Though these two mechanisms account for most entry components, if your app happens to bootstrap or dynamically load a component by type imperatively,
|
you won't have to explicitly set any entry components because Angular adds components listed in `@NgModule.bootstrap` and those in route definitions to entry components automatically. Though these two mechanisms account for most entry components, if your app happens to bootstrap or dynamically load a component by type imperatively,
|
||||||
you must add it to `entryComponents` explicitly.
|
you must add it to `entryComponents` explicitly.
|
||||||
|
@ -627,6 +627,11 @@ The [npm package manager](https://docs.npmjs.com/getting-started/what-is-npm) is
|
|||||||
|
|
||||||
Learn more about how Angular uses [Npm Packages](guide/npm-packages).
|
Learn more about how Angular uses [Npm Packages](guide/npm-packages).
|
||||||
|
|
||||||
|
{@ ngc}
|
||||||
|
## ngc
|
||||||
|
`ngc` is a Typescript-to-Javascript transpiler that processes Angular decorators, metadata, and templates, and emits JavaScript code.
|
||||||
|
The most recent implementation is internally refered to as `ngtsc` because it's a minimalistic wrapper around the TypeScript compiler `tsc` that adds a transform for processing Angular code.
|
||||||
|
|
||||||
{@a O}
|
{@a O}
|
||||||
|
|
||||||
{@a observable}
|
{@a observable}
|
||||||
|
@ -87,7 +87,7 @@ To make one, enter the following command in the terminal, where `customers` is t
|
|||||||
ng generate module customers --route customers --module app.module
|
ng generate module customers --route customers --module app.module
|
||||||
</code-example>
|
</code-example>
|
||||||
|
|
||||||
This creates a `customers` folder with the new lazy-loadable module `CustomersModule` defined in the `customers.module.ts` file. The command automatically declares the `CustomersComponent` inside the new feature module.
|
This creates a `customers` folder having the new lazy-loadable feature module `CustomersModule` defined in the `customers.module.ts` file and the routing module `CustomersRoutingModule` defined in the `customers-routing.module.ts` file. The command automatically declares the `CustomersComponent` and imports `CustomersRoutingModule` inside the new feature module.
|
||||||
|
|
||||||
Because the new module is meant to be lazy-loaded, the command does NOT add a reference to the new feature module in the application's root module file, `app.module.ts`.
|
Because the new module is meant to be lazy-loaded, the command does NOT add a reference to the new feature module in the application's root module file, `app.module.ts`.
|
||||||
Instead, it adds the declared route, `customers` to the `routes` array declared in the module provided as the `--module` option.
|
Instead, it adds the declared route, `customers` to the `routes` array declared in the module provided as the `--module` option.
|
||||||
|
@ -62,6 +62,8 @@ Angular executes hook methods in the following sequence. You can use them to per
|
|||||||
|
|
||||||
Called before `ngOnInit()` and whenever one or more data-bound input properties change.
|
Called before `ngOnInit()` and whenever one or more data-bound input properties change.
|
||||||
|
|
||||||
|
Note that if your component has no inputs or you use it without providing any inputs, the framework will not call `ngOnChanges()`.
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr style='vertical-align:top'>
|
<tr style='vertical-align:top'>
|
||||||
|
@ -141,7 +141,7 @@ Because the token is now an abstract class, and the injectable component impleme
|
|||||||
The implementation of the method (with all of its code overhead) resides in the injectable component that can be tree-shaken.
|
The implementation of the method (with all of its code overhead) resides in the injectable component that can be tree-shaken.
|
||||||
This allows the parent to communicate with the child (if it is present) in a type-safe manner.
|
This allows the parent to communicate with the child (if it is present) in a type-safe manner.
|
||||||
|
|
||||||
For example, the `LibCardComponent` now queries`LibHeaderToken` rather than `LibHeaderComponent`.
|
For example, the `LibCardComponent` now queries `LibHeaderToken` rather than `LibHeaderComponent`.
|
||||||
The following example shows how the pattern allows `LibCardComponent` to communicate with the `LibHeaderComponent` without actually referring to `LibHeaderComponent`.
|
The following example shows how the pattern allows `LibCardComponent` to communicate with the `LibHeaderComponent` without actually referring to `LibHeaderComponent`.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -223,6 +223,6 @@ content harmlessly. The following is the browser output
|
|||||||
of the `evilTitle` examples.
|
of the `evilTitle` examples.
|
||||||
|
|
||||||
<code-example language="bash">
|
<code-example language="bash">
|
||||||
"Template <script>alert("evil never sleeps")</script> Syntax" is the interpolated evil title.
|
"Template <script>alert("evil never sleeps")</script> Syntax" is the interpolated evil title.
|
||||||
"Template alert("evil never sleeps")Syntax" is the property bound evil title.
|
"Template Syntax" is the property bound evil title.
|
||||||
</code-example>
|
</code-example>
|
||||||
|
@ -94,7 +94,7 @@ All of our major releases are supported for 18 months.
|
|||||||
|
|
||||||
* 6 months of *active support*, during which regularly-scheduled updates and patches are released.
|
* 6 months of *active support*, during which regularly-scheduled updates and patches are released.
|
||||||
|
|
||||||
* 12 months of *long-term support (LTS)*, during which only critical fixes and security patches are released.
|
* 12 months of *long-term support (LTS)*, during which only [critical fixes and security patches](#lts-fixes) are released.
|
||||||
|
|
||||||
The following table provides the status for Angular versions under support.
|
The following table provides the status for Angular versions under support.
|
||||||
|
|
||||||
@ -102,11 +102,18 @@ The following table provides the status for Angular versions under support.
|
|||||||
Version | Status | Released | Active Ends | LTS Ends
|
Version | Status | Released | Active Ends | LTS Ends
|
||||||
------- | ------ | ------------ | ------------ | ------------
|
------- | ------ | ------------ | ------------ | ------------
|
||||||
^10.0.0 | Active | Jun 24, 2020 | Dec 24, 2020 | Dec 24, 2021
|
^10.0.0 | Active | Jun 24, 2020 | Dec 24, 2020 | Dec 24, 2021
|
||||||
^9.0.0 | Active | Feb 06, 2020 | Aug 06, 2020 | Aug 06, 2021
|
^9.0.0 | LTS | Feb 06, 2020 | Aug 06, 2020 | Aug 06, 2021
|
||||||
^8.0.0 | LTS | May 28, 2019 | Nov 28, 2019 | Nov 28, 2020
|
^8.0.0 | LTS | May 28, 2019 | Nov 28, 2019 | Nov 28, 2020
|
||||||
|
|
||||||
Angular versions ^4.0.0, ^5.0.0, ^6.0.0 and ^7.0.0 are no longer under support.
|
Angular versions ^4.0.0, ^5.0.0, ^6.0.0 and ^7.0.0 are no longer under support.
|
||||||
|
|
||||||
|
### LTS fixes
|
||||||
|
|
||||||
|
As a general rule, a fix is considered for an LTS version if it resolves one of:
|
||||||
|
|
||||||
|
* a newly identified security vulnerability,
|
||||||
|
* a regression, since the start of LTS, caused by a 3rd party change, such as a new browser version.
|
||||||
|
|
||||||
{@a deprecation}
|
{@a deprecation}
|
||||||
## Deprecation practices
|
## Deprecation practices
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user