Compare commits

..

123 Commits

Author SHA1 Message Date
9de45fa650 docs: add changelog for 5.0.1 2017-11-08 10:29:46 -08:00
953a0e07d6 release: cut the 5.0.1 version 2017-11-08 10:28:13 -08:00
511e56d633 docs(common): fix mis-ordered lines (#20221) 2017-11-06 11:29:12 -08:00
1f1741c5ad build(aio): upgrade to @anglar/core@5.0.0 and cli@1.5.0
-rw-r--r--  1 iminar  eng   14880 Nov  4 11:54
dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1533 Nov  4 11:54
dist/inline.9183bfe0d60f43b6a772.bundle.js
-rw-r--r--  1 iminar  eng  486476 Nov  4 11:54
dist/main.f5445f99490330207c9c.bundle.js
-rw-r--r--  1 iminar  eng   37070 Nov  4 11:54
dist/polyfills.0dfca732c5a075c110d0.bundle.js

Closes #20184
2017-11-06 10:05:23 -08:00
408ffb634e build(aio): remove the build-optimizer flag
it's on by default now.
2017-11-06 10:05:23 -08:00
73d857cb38 build(aio): use aot compiler for development
since it was not turned on by default in the cli we
have to opt in.
2017-11-06 10:05:23 -08:00
3ab0963309 docs(aio): update ToH for CLI (#19811) 2017-11-06 10:02:40 -08:00
da22c48ef1 fix(compiler): report a reasonable error with invalid metadata (#20062)
The compiler would throw an internal exception if an import using
the `ngModule` syntax and the module as not a resolvable symbol.

Fixes: #20049
2017-11-06 10:01:49 -08:00
f80d41f3e5 fix(aio): style correctly on Safari (#20157) 2017-11-06 10:00:57 -08:00
2b7ca4e9f8 ci(aio): move e2e tests to optional job (#20178) 2017-11-06 10:00:23 -08:00
4292540939 docs(aio): fixed case-typo for code (#20196) 2017-11-06 09:59:38 -08:00
708379128f fix(core): should support event.stopImmediatePropagation (#19222) 2017-11-03 15:22:43 -07:00
131368c774 docs(aio): update pipes for CLI (#19553) 2017-11-03 15:21:41 -07:00
94e0ef77ea ci(aio): Add payload size percentage changes check to payload size task (#19908) 2017-11-03 15:20:49 -07:00
e4cd3b0564 test(aio): make e2e tests less flakey
closes #20117
2017-11-03 11:24:04 -07:00
22dc3ad94c build(aio): upgrade protractor to v5.2.0 2017-11-03 11:23:55 -07:00
7077a61614 build(aio): use correct types for e2e tests 2017-11-03 11:23:45 -07:00
9811bef278 docs: Bootstrapping guide prose for CLI (#19777) 2017-11-03 11:13:41 -07:00
3298c4a79f docs: Component Styles guide for CLI (#19791) 2017-11-03 11:12:58 -07:00
5a6efa7a3f fix(platform-browser): support Symbols in custom jasmineToString() method (#19794)
It's illegal to coerce a Symbol to a string, and results in a TypeError:

TypeError: Cannot convert a Symbol value to a string

Previously, the custom jasmineToString() method monkey-patched onto Maps
in platform-browser/testing/src/matchers.ts would coerce keys and values
to strings. A change in a newer version of Jasmine calls this method more
often, resulting in calls against Maps which contain Symbols in some
applications, which causes crashes.

The fix is to explicitly convert keys and values to strings, which does
work on Symbols.
2017-11-03 11:12:09 -07:00
a8c786c8c9 docs: Deployment guide for CLI (#19839) 2017-11-03 11:11:16 -07:00
799cbb932c fix(compiler): don't overwrite missingTranslation's value in JIT (#19952) 2017-11-03 11:09:07 -07:00
e6f16a7629 docs(aio): Fix typo in Architecture Overview. (#20073) 2017-11-03 11:00:44 -07:00
1bb0333c23 docs(aio): Add v4 doc link to navigation (#20089)
Fixes #20090
2017-11-03 10:59:48 -07:00
9fa0ffd8a5 build(aio): make plunker works with rxjs operators (#20124) 2017-11-03 10:48:08 -07:00
678d1cfae1 fix(core): __symbol__ should return __zone_symbol__ without zone.js loaded (#19541) 2017-11-02 16:06:29 -07:00
a897d6842f build: update Windows symlink scripts (#16761)
Fixes packages\upgrade\static\src symlink.

Closes #16760
2017-11-02 16:05:38 -07:00
25843fed53 build(aio): avoid building before running the local PWA tests
When this command is run on CI, `yarn build` has already been run, so
this was unnecessarily building angular.io again (adding ~4mins to the
`aio` job).
When this command is run locally, it is most often about testing a new
`lighthouse` version/config, so you don't need to build angular.io over
and over (and if necessary, one can always run `yarn build` manually).

Closes #19633
2017-11-02 16:04:30 -07:00
762da3b154 build(aio): upgrade lighthouse to v2.5.0 2017-11-02 16:04:19 -07:00
37a740b5b2 build: remove local yarn (#19981)
We use the globally installed yarn now. The local yarn was used in
`check-environment.js` only, which results in the `--integrity` check
always failing (if dependencies were installed with the global yarn).
2017-11-02 15:30:57 -07:00
067e926c08 build(aio): do not fail the initial doc-gen when running docs-watch
Checks that cause the doc-gen to fail were already disabled in `docs-watch`
for the doc-gen that runs when a file is changed.
Now these checks are also disabled for the initial doc-gen run.
closes #20038
2017-11-02 15:06:23 -07:00
bc52e97eba build(aio): do not fail on bad examples when running docs-watch 2017-11-02 15:06:23 -07:00
9b579d85be build(aio): allow render-examples to complete even if examples are broken
By setting `renderExamples.ignoreBrokenExamples = true` the doc-gen will
not fail if there is something wrong with an example. Instead it will
just log a warning.
2017-11-02 15:05:57 -07:00
895d78c0ed docs(aio): fix badly formatted code-examples
closes #19970
2017-11-02 15:05:44 -07:00
803b0f0fb3 build(aio): fail doc-gen if a code-example is badly formatted.
This will catch the problem that was missed in
https://github.com/angular/angular/pull/19845#issuecomment-338626662
2017-11-02 15:05:28 -07:00
86399958dd fix(compiler-cli): don't report emit diagnostics when --noEmitOnError is off (#20063) 2017-11-02 14:53:01 -07:00
d550b6872a docs: fix changelog for v5 (#20097) 2017-11-02 14:42:46 -07:00
92e4c34d01 docs: Add 0 in padding of 'dd' (#20107) 2017-11-02 14:42:34 -07:00
e84695389b docs: AOT guide for CLI #19510 (#19818) 2017-11-02 14:35:35 -07:00
4e48bdff22 docs: BrowserSupport guide for CLI (#19843) 2017-11-02 14:33:44 -07:00
2185e466db docs: Npm Packages guide for CLI (#19850) 2017-11-02 14:28:23 -07:00
6f05dab2fc docs(aio): updated i18n guide and example (#19975) 2017-11-02 14:23:04 -07:00
18197bd56d docs(aio): fix linting for universal (#20086)
PR Close #20086
2017-11-02 00:51:55 +01:00
c75740e585 build(aio): update lockfile for examples (#20084)
Installing dependencies for the docs examples fails, because the
lockfile is out-of-sync with the corresponding `package.json`.
This commit brings the lockfile in sync with `package.json`.

(For reference, this was accidentally broken in #20039.)

PR Close #20084
2017-11-02 00:22:22 +01:00
16d72584cb build(aio): upgrade to @angular/material@2.0.0-beta.12 (#19702)
-rw-r--r--  1 iminar  eng   14880 Nov  1 12:25 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1533 Nov  1 12:25 dist/inline.2826385ad3e299c6d1c1.bundle.js
-rw-r--r--  1 iminar  eng  486476 Nov  1 12:25 dist/main.f0610805f4aad19da4be.bundle.js
-rw-r--r--  1 iminar  eng   37070 Nov  1 12:25 dist/polyfills.0dfca732c5a075c110d0.bundle.js

PR Close #19702
2017-11-01 15:27:00 -07:00
9c9867e840 build(aio): upgrade to @angular/core@5.0.0-rc.9 (#19702)
build fails - material upgrade required

PR Close #19702
2017-11-01 15:26:59 -07:00
55092ace87 revert: build(aio): remove cli patches (#19702)
This reverts commit f0d530b4de38f71c759e42afc8f3d7531eb1b1fb.

cli rc.8 reintroduces the node polyfill which causes size regression,
so I'm putting the patch back in.

-rw-r--r--  1 iminar  eng   14880 Nov  1 12:11 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1533 Nov  1 12:11 dist/inline.25600c3b48de18b97581.bundle.js
-rw-r--r--  1 iminar  eng  486476 Nov  1 12:11 dist/main.d1292a34401056535884.bundle.js
-rw-r--r--  1 iminar  eng   37070 Nov  1 12:11 dist/polyfills.0dfca732c5a075c110d0.bundle.js

PR Close #19702
2017-11-01 15:26:59 -07:00
70edca3cec build(aio): upgrade to @angular/cli@1.5.0-rc.8 (#19702)
-rw-r--r--  1 iminar  eng   14880 Nov  1 11:57 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1533 Nov  1 11:57 dist/inline.3574d1d784c09c507dbd.bundle.js
-rw-r--r--  1 iminar  eng  497812 Nov  1 11:57 dist/main.76bbb69df79eaefef54c.bundle.js
-rw-r--r--  1 iminar  eng   37259 Nov  1 11:57 dist/polyfills.fdb71956ccd13330fb47.bundle.js

PR Close #19702
2017-11-01 15:26:58 -07:00
120ebe8225 build(aio): upgrade to @angular/cli@1.5.0-rc.6 (#19702)
-rw-r--r--  1 iminar  eng   14880 Oct 30 11:29 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1533 Oct 30 11:29 dist/inline.25600c3b48de18b97581.bundle.js
-rw-r--r--  1 iminar  eng  486476 Oct 30 11:29 dist/main.d1292a34401056535884.bundle.js
-rw-r--r--  1 iminar  eng   37070 Oct 30 11:29 dist/polyfills.0dfca732c5a075c110d0.bundle.js

PR Close #19702
2017-11-01 15:26:58 -07:00
7695ad570b ci(aio): decrease payload size limit for main file (#19702)
PR Close #19702
2017-11-01 15:26:58 -07:00
7a708ad387 refactor(aio): rename CustomMdIconRegistry to CustomIconRegistry (#19702)
The change of Angular Material version means that the `md` prefix is
no longer appropriate.

PR Close #19702
2017-11-01 15:26:57 -07:00
71f1ed5795 build(aio): lock zone.js to 0.8.16 (#19702)
Later versions (before 0.8.19) had a size increase.

PR Close #19702
2017-11-01 15:26:57 -07:00
ced5186ca4 style(aio): fix docs linting issues (#19702)
These issues appeared after upgrade of eslint jasmine plugin

PR Close #19702
2017-11-01 15:26:56 -07:00
e48dc270b5 ci(aio): increase payload size limit for polyfills.ts (#19702)
The latest builds have added ~2kB to the size of this file (500 bytes zipped).

PR Close #19702
2017-11-01 15:26:56 -07:00
aa574710c9 build(aio): remove hack to modify CLI version (#19702)
PR Close #19702
2017-11-01 15:26:55 -07:00
d62ef132d2 build(aio): upgrade to Angular@rc.5 and CLI@rc.3 (#19702)
PR Close #19702
2017-11-01 15:26:55 -07:00
428f80e8ae build(aio): revert temporary increase in size limit (#19702)
PR Close #19702
2017-11-01 15:26:55 -07:00
260c9b763c build(aio): fix tests to work with @angular/{material,cdk}@2.0.0-beta.12 (#19702)
PR Close #19702
2017-11-01 15:26:54 -07:00
5f6d71d39a build(aio): remove cli patches (#19702)
PR Close #19702
2017-11-01 15:26:54 -07:00
8133a8d335 build(aio): revert to clean CLI test.ts file (#19702)
The use of `System.import()` in test.ts was causing the webpack build to fail
with a mysterious "Module build failed: Error: TypeScript compilation failed" error,
when running `yarn test`.

PR Close #19702
2017-11-01 15:26:53 -07:00
3e05d62a99 build(aio): temporarily increaze the size limit until the regressions are fixed (#19702)
related issues:
https://github.com/angular/angular/issues/19857
https://github.com/angular/devkit/pull/231

PR Close #19702
2017-11-01 15:26:53 -07:00
db7f2a9ca7 build(aio): disable 'global' support in webpack (#19702)
This will be fixed in CLI once https://github.com/angular/angular-cli/pull/8130 lands.

-rw-r--r--  1 iminar  eng   14942 Oct 20 22:23 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 20 22:23 dist/inline.5d66b81ec9e01af9d28d.bundle.js
-rw-r--r--  1 iminar  eng  528395 Oct 20 22:23 dist/main.e36bb99245ca52ae546f.bundle.js
-rw-r--r--  1 iminar  eng   37205 Oct 20 22:23 dist/polyfills.0dfca732c5a075c110d0.bundle.js

PR Close #19702
2017-11-01 15:26:53 -07:00
59a2fbe74f build(aio): upgrade to build-optimizer@0.0.29 (#19702)
-rw-r--r--  1 iminar  eng   14942 Oct 20 22:16 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 20 22:16 dist/inline.68ebcf831dc9c905804f.bundle.js
-rw-r--r--  1 iminar  eng  541291 Oct 20 22:16 dist/main.5ec6fb5f95fc0433d822.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 20 22:16 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:52 -07:00
3274e1a79a build(aio): upgrade to @angular/cli@1.5.0-rc.2 (#19702)
-rw-r--r--  1 iminar  eng   84219 Oct 19 21:37 dist/0.0f327734d18211139822.chunk.js
-rw-r--r--  1 iminar  eng   14942 Oct 19 21:37 dist/4.c719ac5645940382cdce.chunk.js
-rw-r--r--  1 iminar  eng    1560 Oct 19 21:37 dist/inline.887757679ff553e20b54.bundle.js
-rw-r--r--  1 iminar  eng  492354 Oct 19 21:37 dist/main.5e5dc9ed980c9f5dc2bd.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 19 21:37 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:52 -07:00
6979a29d1f build(aio): upgrade to @angular/cli@1.5.0-rc.1 (#19702)
-rw-r--r--  1 iminar  eng   84219 Oct 18 21:05 dist/0.0f327734d18211139822.chunk.js
-rw-r--r--  1 iminar  eng   14942 Oct 18 21:05 dist/4.c719ac5645940382cdce.chunk.js
-rw-r--r--  1 iminar  eng    1560 Oct 18 21:05 dist/inline.887757679ff553e20b54.bundle.js
-rw-r--r--  1 iminar  eng  492354 Oct 18 21:05 dist/main.5e5dc9ed980c9f5dc2bd.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 18 21:05 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:51 -07:00
9da5ca7ae6 build(aio): upgrade to rxjs@5.5.0 (#19702)
-rw-r--r--  1 iminar  eng   84219 Oct 18 09:13 dist/0.8ef208c27531d5c6af63.chunk.js
-rw-r--r--  1 iminar  eng   14942 Oct 18 09:13 dist/4.c719ac5645940382cdce.chunk.js
-rw-r--r--  1 iminar  eng    1560 Oct 18 09:13 dist/inline.adc367eb50c706f3fd04.bundle.js
-rw-r--r--  1 iminar  eng  492354 Oct 18 09:13 dist/main.b9d9549455c74aff1480.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 18 09:13 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:51 -07:00
e51ac3671f build(aio): turn off preserveWhitespaces in compiler options (#19702)
-rw-r--r--  1 iminar  eng   14942 Oct 13 16:12 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 16:12 dist/inline.eede8140efeab4c45b22.bundle.js
-rw-r--r--  1 iminar  eng  559389 Oct 13 16:12 dist/main.20858f9aa7cf8741b6aa.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 16:12 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:50 -07:00
3393009b69 build(aio): patch @angular/cli to use esm builds of rxjs (#19702)
-rw-r--r--  1 iminar  eng   14942 Oct 13 14:52 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 14:52 dist/inline.6ca24f1c3b848103b041.bundle.js
-rw-r--r--  1 iminar  eng  567802 Oct 13 14:52 dist/main.c8183a2c0116782ca366.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 14:52 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:50 -07:00
12e4b5667e build(aio): upgrade to rxjs@5.5.0-beta.7 (#19702)
-rw-r--r--  1 iminar  eng   14942 Oct 13 14:30 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 14:30 dist/inline.702d6ff5146ddc373f05.bundle.js
-rw-r--r--  1 iminar  eng  588943 Oct 13 14:30 dist/main.64c96d55a10c56cfd6cd.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 14:30 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:50 -07:00
0f8b83200a build(aio): upgrade to @angular/{material,cdk}@2.0.0-beta.12 (#19702)
-rw-r--r--  1 iminar  eng   14942 Oct 13 13:35 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 13:35 dist/inline.f005f1bd6803b72f5961.bundle.js
-rw-r--r--  1 iminar  eng  582527 Oct 13 13:35 dist/main.b9ef1abb785be8de15b8.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 13:35 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:49 -07:00
253e89dfac fix(aio): hand fix the renaming md->mat issues (#19702)
These are changes that the mat-switcher missed and I had to make them by hand.

PR Close #19702
2017-11-01 15:26:49 -07:00
c4772ee002 build(aio): upgrade to @angular/{material,cdk}@2.0.0-beta.11 + md->mat migration (#19702)
all the non-npm changes were made by the angular-material-prefix-updater tool.

the tool missed a few things, which I'll fix in a separate commit to preserve the diff.

-rw-r--r--  1 iminar  eng   14942 Oct 13 13:09 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 13:09 dist/inline.0592c25ceb544d6aca3d.bundle.js
-rw-r--r--  1 iminar  eng  578250 Oct 13 13:09 dist/main.45d4edca3facc6d621e7.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 13:09 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:48 -07:00
35ec4af2b1 build(aio): upgrade to @angular/cli@1.5.0-rc.0 and typescript@2.5.3 (#19702)
the size regression has gotten worse:

-rw-r--r--  1 iminar  eng   14942 Oct 13 12:24 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 12:24 dist/inline.41e701c562960ede8ef5.bundle.js
-rw-r--r--  1 iminar  eng  865780 Oct 13 12:24 dist/main.6c4c605d461870b9c2d7.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 12:24 dist/polyfills.f8409a9eb69060ac1aa6.bundle.js

PR Close #19702
2017-11-01 15:26:48 -07:00
19b48429ef build(aio): upgrade to @angular/cli@1.4.7 (#19702)
this causes the size regression to get only worse:

-rw-r--r--  1 iminar  eng   14942 Oct 13 10:37 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 10:37 dist/inline.3cc964095cb25e329dc0.bundle.js
-rw-r--r--  1 iminar  eng  846141 Oct 13 10:37 dist/main.5eb64df77b2877327a16.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 10:37 dist/polyfills.965a9a5ad3e11b17f85e.bundle.js

PR Close #19702
2017-11-01 15:26:47 -07:00
b796419e7e build(aio): update to @angular/core@5.0.0-rc.2 (#19702)
there is a size regression right now because the CLI is out of date:

-rw-r--r--  1 iminar  eng   14942 Oct 13 10:23 dist/0.b19e913fbdd6507d346b.chunk.js
-rw-r--r--  1 iminar  eng    1535 Oct 13 10:23 dist/inline.812a4af83ecce165c71c.bundle.js
-rw-r--r--  1 iminar  eng  643481 Oct 13 10:23 dist/main.74550bb35f9f5a57e78a.bundle.js
-rw-r--r--  1 iminar  eng   37402 Oct 13 10:23 dist/polyfills.965a9a5ad3e11b17f85e.bundle.js

PR Close #19702
2017-11-01 15:26:47 -07:00
a1ec65b1dd docs(aio): fix typo in attribute-directives
Closes #20071
2017-11-01 15:21:40 -07:00
851e1cfcfd docs(aio): update universal for CLI
PR Close #20039
2017-11-01 15:19:33 -07:00
a363be6b5c docs(aio): upgrade to v5 and cli 1.5
PR Close #20077
2017-11-01 14:14:38 -07:00
e1fb65cac4 docs(packaging): fix typo
PR Close #18915
2017-11-01 16:55:41 -04:00
b497e9e6ee fix(docs): Fix 404 on amcdnl image
PR Close #19120
2017-11-01 16:55:36 -04:00
706ba38498 docs: fix link texts
Fixes #19701

PR Close #19709
2017-11-01 16:55:25 -04:00
78052e4984 docs(aio): update AngularJS Quick Reference guide
PR Close #19939
2017-11-01 16:55:17 -04:00
bf861f5539 docs(aio): fix typo
PR Close #20029
2017-11-01 16:55:09 -04:00
d99a5ec494 docs(aio): fix typo
PR Close #20042
2017-11-01 16:55:01 -04:00
d651fc0d6a docs(aio): fix typo
PR Close #20069
2017-11-01 16:54:52 -04:00
5775376bcf docs: add changelog for 5.0.0 2017-11-01 10:50:28 -07:00
896b853519 release: cut the 5.0.0 release 2017-11-01 09:44:19 -07:00
5225fdbc0e build(aio): add i18n boilerplate type (#20004)
PR Close #20004
2017-10-31 01:46:06 -04:00
f5b7f2b9a5 docs: add changelog for 5.0.0-rc.9 2017-10-30 21:09:14 -07:00
509f392ab0 release: cut the 5.0.0-rc.9 release 2017-10-30 21:07:37 -07:00
cf5fce8d5e build: update rollup lint rule from bad merge (#20047)
PR Close #20047
2017-10-30 23:45:06 -04:00
f1248b69e6 refactor: make all rollup config ES5 compatible (#20028)
So they can be required by other Node scripts.

PR Close #20028
2017-10-30 23:28:18 -04:00
4498dddbe3 build: add lint rule for global flags in rollup config (#20028)
We now verify that every imports is part of the globals defined in the files rollup.config.js.

PR Close #20028
2017-10-30 23:28:11 -04:00
812786f44e fix: add missing globals from each rollup configuration (#20028)
PR Close #20028
2017-10-30 23:11:42 -04:00
de24d54517 fix(compiler): report errors properly in G3 in certain conditions (#20041)
Condition: static analysis error, given:
- noResolve:true
- generateCodeForLibraries: false
- CompilerHost.getSourceFile throws on non existent files

All of these are true in G3.
PR Close #20041
2017-10-30 23:07:37 -04:00
c295aeeca2 build: add release as a valid commit message subject (#19955)
PR Close #19955
2017-10-30 21:23:48 -04:00
a8add78fe1 build: temporarily increase the commit msg limit to 120
Right now HEAD and 5.0.x have a branch deviation and therefore
all the commits between both branches are being compared. There
exists a problematic commit which has a commit message that is
longer than 100 commits. This patch will temporarily increase
the limit to 120 so that CI passes. Once master is resumed to
being the primary development branch (once 5.0.0 is out) then
the the msg limit will be set back to 100.
2017-10-30 21:23:43 -04:00
e3a16ed02d fix(compiler): reexport less symbols in .ngfactory.ts files (#19884)
* don't reexport symbols that the user already reexported
* never reexport symbols that are part of arguments of non simple function calls

Fixes #19883

PR Close #19884
2017-10-30 21:19:44 -04:00
fd37f3fbab fix(compiler): always use relative paths to refer to generated code
Previously we generated imports like `@angular/material/index.ngfactory`,
which doesn’t make sense as we don’t ship generated code on npm

Closes #20031
2017-10-30 20:00:48 -04:00
85e95cc32b docs: add changelog for 5.0.0-rc.8 2017-10-27 23:31:35 -07:00
de71ba74bb release: cut the 5.0.0-rc.8 release 2017-10-27 23:31:27 -07:00
a01c877534 docs: ensure examples get rxjs ^5.5.0 (#19985)
This change coincidentally updates other packages that were in `package.json`
because it regenerates `yarn.lock`. This too should be fine.

PR Close #19985
2017-10-27 22:28:21 -07:00
2d508a3ef0 fix(compiler-cli): avoid producing source mappings for host views (#19965)
The host view doesn't map back to user code so the template compiler
produces a blank `url` for them.

PR Close #19965
2017-10-27 22:28:14 -07:00
4285b6c3e3 fix(platform-server): add missing packages to the UMD global rollup config
This adds the proper bindings for calling angular packages from platform-server in the UMD.
This was not a problem for universal apps that dont use UMD.

Fixes 19899
2017-10-27 22:27:43 -07:00
5542517b9c docs: add changelog for 5.0.0-rc.7 2017-10-26 19:03:14 -07:00
fef3539608 release: cut the 5.0.0-rc.7 release 2017-10-26 19:01:34 -07:00
f4d5729cb3 fix(compiler): make watch mode work on windows (#19953)
Fixes #19951
PR Close #19953
2017-10-26 21:52:35 -04:00
d343bf7885 fix(compiler): recover from structural errors in watch mode (#19953)
This also changes the compiler so that we throw less often
on structural changes and produce a meaningful state
in the `ng.Program` in case of errors.

Related to #19951

PR Close #19953
2017-10-26 21:52:25 -04:00
9ce7f0e538 fix(compiler): translate emit diagnostics with noEmitOnError: true. (#19953)
This prevents errors reported against `.ngfactory.ts` files show up
as the result of running `ngc`.

Closes #19935
PR Close #19953
2017-10-26 21:52:16 -04:00
4a23df3909 fix(compiler): don’t store invalid state when using listLazyRoutes (#19953)
Previously, `listLazyRoute` would store invalid information in a compiler
internal cache, which lead to incorrect paths that were used during emit.
This commit fixes this.

PR Close #19953
2017-10-26 21:51:43 -04:00
14016c781f fix(service-worker): fix improper call of Observable.merge (#19962)
Observable.merge was called using .call() as if it were an operator
and not an Observable factory. This removes the .call() and uses
the factory properly.

PR Close #19962
2017-10-26 18:16:20 -04:00
47caebfe86 fix(service-worker): don't block initialization on registration (#19936)
Importing ServiceWorkerModule.register() will schedule registration of
the Service Worker inside an APP_INITIALIZER. Previously, the Promise
returned by navigator.serviceWorker.register() was returned from the
initializer function. This has the unwanted side effect of blocking
initialization until the SW is registered. Even worse, if the SW script
fails to load, this can cause the app initialization to fail.

The solution is to not return the registration promise from the
initializer function, essentially decoupling registration from the rest
of the initialization flow.

This change is not unit testable as there are no mocks/adapters yet for
navigator.serviceWorker. A future integration test should cover this case
with better fidelity.

PR Close #19936
2017-10-26 16:10:17 -04:00
5cfd9c6020 fix(service-worker): listen for messages on the right event source (#19954)
Currently, the SwUpdate service doesn't receive messages from the SW.
This is because it attempts to subscribe to the 'message' event on
ServiceWorkerRegistration, when really messages are emitted by the
ServiceWorkerContainer.

This change moves to listening on ServiceWorkerContainer and changes
the mocks to reflect the way the browser actually works.

PR Close #19954
2017-10-26 16:10:07 -04:00
47bc6f105d docs: add changelog for 5.0.0-rc.6 2017-10-25 14:34:42 -07:00
40fa2593a9 release: cut the 5.0.0-rc.6 release 2017-10-25 14:32:11 -07:00
680bcf7b8a build: update to rxjs@5.5.2 (#19931)
PR Close #19931
2017-10-25 15:32:01 -04:00
ef08330341 fix(compiler): automatically set emitDecoratorMetadata when "annotationsAs": "static fields” (#19927)
This is a workaround for https://github.com/angular/tsickle/issues/635.

Fixes #19916
PR Close #19927
2017-10-25 14:26:28 -04:00
6cc042e2ba fix(compiler-cli): produce correct paths for windows output (#19915)
The path mapping was broken for Windows by fc0b1d5b61.
Fixed the path mapping and put code in place to make such a problem
to sneek by again.

PR Close #19915
2017-10-24 19:21:18 -04:00
9b26455740 fix(compiler-cli): only use error collector when needed. (#19912)
The error collector changes behavior of the metadata resolver
in ways that haven't been fully hardened. This changes limits
its use to the lazy route detection and the language service.

Issue: #19906

PR Close #19912
2017-10-24 19:21:13 -04:00
18bce5987c fix(compiler): don’t type check templates with skipTemplateCodegen (#19909)
This change is needed to prevent users’ builds from breaking.

If a user sets `fullTemlateTypeCheck` to true, we will
continue to check the templates even when `skipTemplateCodegen` is true
as well.

Related to #19906

PR Close #19909
2017-10-24 19:21:03 -04:00
f1108fea76 docs: add changelog for 5.0.0-rc.5 2017-10-23 23:28:28 -07:00
64b3e3e41a release: cut the 5.0.0-rc.5 release 2017-10-23 23:27:15 -07:00
a82f863e24 fix(compiler-cli): report all diagnostic error messages (#19886)
This fixes a problem introduced in 8d45fefc31
which modified how diagnostic error messages are reported for structural
metadata errors causing some of the diagnostics to be lost.

PR Close #19886
2017-10-24 00:57:41 -04:00
358 changed files with 4246 additions and 7156 deletions

18
.bazelrc Normal file
View File

@ -0,0 +1,18 @@
# Make compilation fast, by keeping a few copies of the compilers
# running as daemons, and cache SourceFile AST's to reduce parse time.
build --strategy=TypeScriptCompile=worker
build --strategy=AngularTemplateCompile=worker
# Don't create bazel-* symlinks in the WORKSPACE directory.
# These require .gitignore and may scare users.
# Also, it's a workaround for https://github.com/bazelbuild/rules_typescript/issues/12
# which affects the common case of having `tsconfig.json` in the WORKSPACE directory.
#
# Instead, you should run `bazel info bazel-bin` to find out where the outputs went.
build --symlink_prefix=/
# Performance: avoid stat'ing input files
build --watchfs
# Don't print all the .d.ts output locations after builds
build --show_result=0

View File

@ -22,6 +22,7 @@
# petebacondarwin - Pete Bacon Darwin # petebacondarwin - Pete Bacon Darwin
# pkozlowski-opensource - Pawel Kozlowski # pkozlowski-opensource - Pawel Kozlowski
# robwormald - Rob Wormald # robwormald - Rob Wormald
# tbosch - Tobias Bosch
# tinayuangao - Tina Gao # tinayuangao - Tina Gao
# vicb - Victor Berchet # vicb - Victor Berchet
# vikerman - Vikram Subramanian # vikerman - Vikram Subramanian
@ -99,6 +100,7 @@ groups:
users: users:
- alexeagle - alexeagle
- mhevery - mhevery
- tbosch
- vicb - vicb
- IgorMinar #fallback - IgorMinar #fallback
@ -107,7 +109,8 @@ groups:
files: files:
- "packages/core/*" - "packages/core/*"
users: users:
- chuckjaz #primary - tbosch #primary
- chuckjaz
- mhevery - mhevery
- vicb - vicb
- IgorMinar #fallback - IgorMinar #fallback
@ -129,7 +132,7 @@ groups:
- "packages/compiler/src/i18n/*" - "packages/compiler/src/i18n/*"
users: users:
- vicb #primary - vicb #primary
- chuckjaz - tbosch
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -138,8 +141,9 @@ groups:
files: files:
- "packages/compiler/*" - "packages/compiler/*"
users: users:
- chuckjaz #primary - tbosch #primary
- vicb - vicb
- chuckjaz
- mhevery - mhevery
- IgorMinar #fallback - IgorMinar #fallback
@ -159,11 +163,12 @@ groups:
- "packages/compiler-cli/*" - "packages/compiler-cli/*"
- "packages/bazel/*" - "packages/bazel/*"
exclude: exclude:
- "packages/compiler-cli/src/ngtools*" - "packages/compiler-cli/src/ngtools*"
users: users:
- alexeagle - alexeagle
- chuckjaz - chuckjaz
- vicb - vicb
- tbosch
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -207,7 +212,7 @@ groups:
- "packages/language-service/*" - "packages/language-service/*"
users: users:
- chuckjaz #primary - chuckjaz #primary
# needs secondary - tbosch #secondary
- vicb - vicb
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -237,8 +242,8 @@ groups:
files: files:
- "packages/platform-browser/*" - "packages/platform-browser/*"
users: users:
- vicb #primary - tbosch #primary
# needs secondary - vicb #secondary
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -248,9 +253,9 @@ groups:
- "packages/platform-server/*" - "packages/platform-server/*"
users: users:
- vikerman #primary - vikerman #primary
# needs secondary
- alxhub - alxhub
- vicb - vicb
- tbosch
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -260,7 +265,7 @@ groups:
- "packages/platform-webworker/*" - "packages/platform-webworker/*"
users: users:
- vicb #primary - vicb #primary
# needs secondary - tbosch #secondary
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback
@ -279,7 +284,7 @@ groups:
files: files:
- "packages/benchpress/*" - "packages/benchpress/*"
users: users:
# needs primary - tbosch #primary
# needs secondary # needs secondary
- IgorMinar #fallback - IgorMinar #fallback
- mhevery #fallback - mhevery #fallback

View File

@ -1,172 +1,3 @@
<a name="5.1.0-rc.1"></a>
# [5.1.0-rc.1](https://github.com/angular/angular/compare/5.1.0-rc.0...5.1.0-rc.1) (2017-12-01)
### Bug Fixes
* **compiler-cli:** propagate ts.SourceFile moduleName into metadata ([f841fbe](https://github.com/angular/angular/commit/f841fbe))
* **service-worker:** allow disabling SW while still using services ([65f4fad](https://github.com/angular/angular/commit/65f4fad))
* **service-worker:** don't crash if SW not supported ([b9a91a5](https://github.com/angular/angular/commit/b9a91a5))
* **service-worker:** send initialization signal from the application ([3fbcde9](https://github.com/angular/angular/commit/3fbcde9))
* **service-worker:** use relative path for ngsw.json ([f582620](https://github.com/angular/angular/commit/f582620))
<a name="5.0.5"></a>
## [5.0.5](https://github.com/angular/angular/compare/5.0.4...5.0.5) (2017-12-01)
### Bug Fixes
* **compiler-cli:** propagate ts.SourceFile moduleName into metadata ([a2ff4ab](https://github.com/angular/angular/commit/a2ff4ab))
* **service-worker:** allow disabling SW while still using services ([f99335b](https://github.com/angular/angular/commit/f99335b))
* **service-worker:** don't crash if SW not supported ([ee37d4b](https://github.com/angular/angular/commit/ee37d4b))
* **service-worker:** send initialization signal from the application ([6bf07b4](https://github.com/angular/angular/commit/6bf07b4))
* **service-worker:** use relative path for ngsw.json ([56c98f7](https://github.com/angular/angular/commit/56c98f7))
<a name="5.1.0-rc.0"></a>
# [5.1.0-rc.0](https://github.com/angular/angular/compare/5.1.0-beta.2...5.1.0-rc.0) (2017-12-01)
### Bug Fixes
* **animations:** ensure multi-level enter animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([dd6237e](https://github.com/angular/angular/commit/dd6237e))
* **animations:** ensure multi-level enter animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([b2a586c](https://github.com/angular/angular/commit/b2a586c))
* **animations:** ensure multi-level leave animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([1366762](https://github.com/angular/angular/commit/1366762))
* **animations:** ensure multi-level leave animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([c2b3792](https://github.com/angular/angular/commit/c2b3792))
* **bazel:** produce named AMD modules for codegen ([#20547](https://github.com/angular/angular/issues/20547)) ([6e83204](https://github.com/angular/angular/commit/6e83204)), closes [#19422](https://github.com/angular/angular/issues/19422)
* **common:** accept falsy values as HTTP bodies ([#19958](https://github.com/angular/angular/issues/19958)) ([15a54df](https://github.com/angular/angular/commit/15a54df)), closes [#19825](https://github.com/angular/angular/issues/19825) [#19195](https://github.com/angular/angular/issues/19195)
* **common:** don't strip XSSI prefix for if error isn't JSON ([#19958](https://github.com/angular/angular/issues/19958)) ([aafa75d](https://github.com/angular/angular/commit/aafa75d))
* **common:** remove useless guard in HttpClient ([#19958](https://github.com/angular/angular/issues/19958)) ([eb01ad5](https://github.com/angular/angular/commit/eb01ad5)), closes [#19223](https://github.com/angular/angular/issues/19223)
* **common:** treat an empty body as null when parsing JSON in HttpClient ([#19958](https://github.com/angular/angular/issues/19958)) ([503be69](https://github.com/angular/angular/commit/503be69)), closes [#18680](https://github.com/angular/angular/issues/18680) [#19413](https://github.com/angular/angular/issues/19413) [#19502](https://github.com/angular/angular/issues/19502) [#19555](https://github.com/angular/angular/issues/19555)
* **compiler:** correctly detect when to serialze summary metadata ([#20668](https://github.com/angular/angular/issues/20668)) ([8bb42df](https://github.com/angular/angular/commit/8bb42df))
* **compiler-cli:** fix memory leak in program creation ([#20692](https://github.com/angular/angular/issues/20692)) ([71e5de6](https://github.com/angular/angular/commit/71e5de6)), closes [#20691](https://github.com/angular/angular/issues/20691)
* **compiler-cli:** normalize sourcepaths for i18n extracted files ([#20417](https://github.com/angular/angular/issues/20417)) ([de78307](https://github.com/angular/angular/commit/de78307)), closes [#20416](https://github.com/angular/angular/issues/20416)
* **core:** should use native addEventListener in ngZone ([#20672](https://github.com/angular/angular/issues/20672)) ([65a2cb8](https://github.com/angular/angular/commit/65a2cb8))
* **language-service:** Allow empty templates ([#20651](https://github.com/angular/angular/issues/20651)) ([3203069](https://github.com/angular/angular/commit/3203069)), closes [#19406](https://github.com/angular/angular/issues/19406)
* **language-service:** Fix crash when no script files are found ([#20550](https://github.com/angular/angular/issues/20550)) ([54bfe14](https://github.com/angular/angular/commit/54bfe14)), closes [#19325](https://github.com/angular/angular/issues/19325)
### Features
* **common:** add locale id parameter to `registerLocaleData` ([#20623](https://github.com/angular/angular/issues/20623)) ([24bf3e2](https://github.com/angular/angular/commit/24bf3e2))
* **compiler-cli:** improve error messages produced during structural errors ([#20459](https://github.com/angular/angular/issues/20459)) ([8ecda94](https://github.com/angular/angular/commit/8ecda94))
<a name="5.0.4"></a>
## [5.0.4](https://github.com/angular/angular/compare/5.0.3...5.0.4) (2017-12-01)
### Bug Fixes
* **animations:** ensure multi-level enter animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([22bbd6e](https://github.com/angular/angular/commit/22bbd6e))
* **animations:** ensure multi-level leave animations work ([#19455](https://github.com/angular/angular/issues/19455)) ([c7b211c](https://github.com/angular/angular/commit/c7b211c))
* **common:** accept falsy values as HTTP bodies ([#19958](https://github.com/angular/angular/issues/19958)) ([66fd1f8](https://github.com/angular/angular/commit/66fd1f8)), closes [#19825](https://github.com/angular/angular/issues/19825) [#19195](https://github.com/angular/angular/issues/19195)
* **common:** don't strip XSSI prefix for if error isn't JSON ([#19958](https://github.com/angular/angular/issues/19958)) ([ead7596](https://github.com/angular/angular/commit/ead7596))
* **common:** remove useless guard in HttpClient ([#19958](https://github.com/angular/angular/issues/19958)) ([e099911](https://github.com/angular/angular/commit/e099911)), closes [#19223](https://github.com/angular/angular/issues/19223)
* **common:** treat an empty body as null when parsing JSON in HttpClient ([#19958](https://github.com/angular/angular/issues/19958)) ([bdaee50](https://github.com/angular/angular/commit/bdaee50)), closes [#18680](https://github.com/angular/angular/issues/18680) [#19413](https://github.com/angular/angular/issues/19413) [#19502](https://github.com/angular/angular/issues/19502) [#19555](https://github.com/angular/angular/issues/19555)
* **compiler-cli:** fix memory leak in program creation ([#20692](https://github.com/angular/angular/issues/20692)) ([38be44d](https://github.com/angular/angular/commit/38be44d)), closes [#20691](https://github.com/angular/angular/issues/20691)
* **compiler-cli:** normalize sourcepaths for i18n extracted files ([#20417](https://github.com/angular/angular/issues/20417)) ([2b0c896](https://github.com/angular/angular/commit/2b0c896)), closes [#20416](https://github.com/angular/angular/issues/20416)
<a name="5.1.0-beta.2"></a>
# [5.1.0-beta.2](https://github.com/angular/angular/compare/5.1.0-beta.1...5.1.0-beta.2) (2017-11-22)
### Bug Fixes
* **animations:** always fire inner trigger callbacks even if blocked by parent animations ([#19753](https://github.com/angular/angular/issues/19753)) ([0e012c9](https://github.com/angular/angular/commit/0e012c9)), closes [#19100](https://github.com/angular/angular/issues/19100)
* **animations:** always fire start and done callbacks in order for noop animations ([#20570](https://github.com/angular/angular/issues/20570)) ([ffb6dbe](https://github.com/angular/angular/commit/ffb6dbe))
* **animations:** validate against trigger() names that use @ symbols ([#20326](https://github.com/angular/angular/issues/20326)) ([1861e41](https://github.com/angular/angular/commit/1861e41))
* **benchpress:** Allow ignoring navigationStart events in perflog metric. ([#20312](https://github.com/angular/angular/issues/20312)) ([717ac5a](https://github.com/angular/angular/commit/717ac5a))
* **common:** return ISubscription from Location.subscribe() ([#20429](https://github.com/angular/angular/issues/20429)) ([437a044](https://github.com/angular/angular/commit/437a044)), closes [#20406](https://github.com/angular/angular/issues/20406)
* **compiler:** emit correct type-check-blocks with TemplateRef's ([#20463](https://github.com/angular/angular/issues/20463)) ([68b53c0](https://github.com/angular/angular/commit/68b53c0))
* **compiler:** support event bindings in `fullTemplateTypeCheck` ([#20490](https://github.com/angular/angular/issues/20490)) ([4ed0439](https://github.com/angular/angular/commit/4ed0439))
* **core:** fix [#20532](https://github.com/angular/angular/issues/20532), should be able to cancel listener from mixed zone ([#20538](https://github.com/angular/angular/issues/20538)) ([a740e4f](https://github.com/angular/angular/commit/a740e4f))
* **core:** should support event.stopImmediatePropagation ([#20469](https://github.com/angular/angular/issues/20469)) ([997336b](https://github.com/angular/angular/commit/997336b))
* **forms:** updateOn should check if change occurred ([#20358](https://github.com/angular/angular/issues/20358)) ([69c53c3](https://github.com/angular/angular/commit/69c53c3)), closes [#20259](https://github.com/angular/angular/issues/20259)
### Features
* **platform-browser-dynamic:** export `JitCompilerFactory` ([#20478](https://github.com/angular/angular/issues/20478)) ([d7a727c](https://github.com/angular/angular/commit/d7a727c)), closes [#20125](https://github.com/angular/angular/issues/20125)
<a name="5.0.3"></a>
## [5.0.3](https://github.com/angular/angular/compare/5.0.2...5.0.3) (2017-11-22)
### Bug Fixes
* **animations:** always fire inner trigger callbacks even if blocked by parent animations ([#19753](https://github.com/angular/angular/issues/19753)) ([814f062](https://github.com/angular/angular/commit/814f062)), closes [#19100](https://github.com/angular/angular/issues/19100)
* **animations:** validate against trigger() names that use @ symbols ([#20326](https://github.com/angular/angular/issues/20326)) ([15795d0](https://github.com/angular/angular/commit/15795d0))
* **benchpress:** Allow ignoring navigationStart events in perflog metric. ([#20312](https://github.com/angular/angular/issues/20312)) ([9ca6ee9](https://github.com/angular/angular/commit/9ca6ee9))
* **common:** return ISubscription from Location.subscribe() ([#20429](https://github.com/angular/angular/issues/20429)) ([bc904b1](https://github.com/angular/angular/commit/bc904b1)), closes [#20406](https://github.com/angular/angular/issues/20406)
* **compiler:** emit correct type-check-blocks with TemplateRef's ([#20463](https://github.com/angular/angular/issues/20463)) ([81f1d42](https://github.com/angular/angular/commit/81f1d42))
* **compiler:** support event bindings in `fullTemplateTypeCheck` ([#20490](https://github.com/angular/angular/issues/20490)) ([b53ead4](https://github.com/angular/angular/commit/b53ead4))
* **core:** fix [#20532](https://github.com/angular/angular/issues/20532), should be able to cancel listener from mixed zone ([#20538](https://github.com/angular/angular/issues/20538)) ([0feba49](https://github.com/angular/angular/commit/0feba49))
* **core:** should support event.stopImmediatePropagation ([#20469](https://github.com/angular/angular/issues/20469)) ([82aace6](https://github.com/angular/angular/commit/82aace6))
* **forms:** updateOn should check if change occurred ([#20358](https://github.com/angular/angular/issues/20358)) ([f9f2c20](https://github.com/angular/angular/commit/f9f2c20)), closes [#20259](https://github.com/angular/angular/issues/20259)
<a name="5.1.0-beta.1"></a>
# [5.1.0-beta.1](https://github.com/angular/angular/compare/5.1.0-beta.0...5.1.0-beta.1) (2017-11-16)
### Bug Fixes
* **animations:** always fire inner trigger callbacks even if blocked by parent animations ([#19753](https://github.com/angular/angular/issues/19753)) ([d47b2a6](https://github.com/angular/angular/commit/d47b2a6)), closes [#19100](https://github.com/angular/angular/issues/19100)
* **animations:** ensure final state() styles are applied within @.disabled animations ([#20267](https://github.com/angular/angular/issues/20267)) ([20aafff](https://github.com/angular/angular/commit/20aafff)), closes [#20266](https://github.com/angular/angular/issues/20266)
* **bazel:** adjust mock of tsconfig for ng_module rule unit test ([#20175](https://github.com/angular/angular/issues/20175)) ([c2a24b4](https://github.com/angular/angular/commit/c2a24b4))
* **compiler:** fix corner cases in shadow CSS ([c32f5fd](https://github.com/angular/angular/commit/c32f5fd))
* **compiler:** recognize @NgModule with a redundant @Injectable ([#20320](https://github.com/angular/angular/issues/20320)) ([c33a576](https://github.com/angular/angular/commit/c33a576))
* **compiler:** show explanatory text in template errors ([#20313](https://github.com/angular/angular/issues/20313)) ([3257fcd](https://github.com/angular/angular/commit/3257fcd))
* **core:** ensure init lifecycle events are called ([#20258](https://github.com/angular/angular/issues/20258)) ([24cf8b3](https://github.com/angular/angular/commit/24cf8b3))
* **language-service:** pass compilerOptions.paths to ReflectorHost ([#20222](https://github.com/angular/angular/issues/20222)) ([eb8013e](https://github.com/angular/angular/commit/eb8013e))
* **router:** 'merge' queryParamHandling strategy should be able to remove query params ([#19733](https://github.com/angular/angular/issues/19733)) ([a622e19](https://github.com/angular/angular/commit/a622e19)), closes [#18463](https://github.com/angular/angular/issues/18463) [#17202](https://github.com/angular/angular/issues/17202)
* Update test code to type-check under TS 2.5 ([#20175](https://github.com/angular/angular/issues/20175)) ([5ec1717](https://github.com/angular/angular/commit/5ec1717))
### Features
* **typescript:** support TypeScript 2.5 ([a9f3e2b](https://github.com/angular/angular/commit/a9f3e2b)), closes [#20175](https://github.com/angular/angular/issues/20175)
> Note, if you do `Injector.get(Token)` where `Token` has static members, you'll run into https://github.com/Microsoft/TypeScript/issues/20102 where the returned type is `{}` rather than `Token`. Use `Injector.get<Token>(Token)` to work around.
<a name="5.0.2"></a>
## [5.0.2](https://github.com/angular/angular/compare/5.0.1...5.0.2) (2017-11-16)
### Bug Fixes
* **animations:** ensure final state() styles are applied within @.disabled animations ([#20267](https://github.com/angular/angular/issues/20267)) ([8b1a6b1](https://github.com/angular/angular/commit/8b1a6b1)), closes [#20266](https://github.com/angular/angular/issues/20266)
* **compiler:** fix corner cases in shadow CSS ([5d1cd57](https://github.com/angular/angular/commit/5d1cd57))
* **compiler:** recognize @NgModule with a redundant @Injectable ([#20320](https://github.com/angular/angular/issues/20320)) ([4cc6abb](https://github.com/angular/angular/commit/4cc6abb))
* **compiler:** show explanatory text in template errors ([#20313](https://github.com/angular/angular/issues/20313)) ([424a323](https://github.com/angular/angular/commit/424a323))
* **router:** 'merge' queryParamHandling strategy should be able to remove query params ([#19733](https://github.com/angular/angular/issues/19733)) ([b732fb9](https://github.com/angular/angular/commit/b732fb9)), closes [#18463](https://github.com/angular/angular/issues/18463) [#17202](https://github.com/angular/angular/issues/17202)
<a name="5.1.0-beta.0"></a>
# [5.1.0-beta.0](https://github.com/angular/angular/compare/5.0.0-rc.4...5.1.0-beta.0) (2017-11-08)
### Bug Fixes
* **compiler:** don't overwrite missingTranslation's value in JIT ([#19952](https://github.com/angular/angular/issues/19952)) ([799cbb9](https://github.com/angular/angular/commit/799cbb9))
* **compiler:** report a reasonable error with invalid metadata ([#20062](https://github.com/angular/angular/issues/20062)) ([da22c48](https://github.com/angular/angular/commit/da22c48))
* **compiler-cli:** don't report emit diagnostics when `--noEmitOnError` is off ([#20063](https://github.com/angular/angular/issues/20063)) ([8639995](https://github.com/angular/angular/commit/8639995))
* **core:** `__symbol__` should return `__zone_symbol__` without zone.js loaded ([#19541](https://github.com/angular/angular/issues/19541)) ([678d1cf](https://github.com/angular/angular/commit/678d1cf))
* **core:** should support event.stopImmediatePropagation ([#19222](https://github.com/angular/angular/issues/19222)) ([7083791](https://github.com/angular/angular/commit/7083791))
* **platform-browser:** support Symbols in custom `jasmineToString()` method ([#19794](https://github.com/angular/angular/issues/19794)) ([5a6efa7](https://github.com/angular/angular/commit/5a6efa7))
### Features
* **compiler:** introduce `TestBed.overrideTemplateUsingTestingModule` ([a460066](https://github.com/angular/angular/commit/a460066)), closes [#19815](https://github.com/angular/angular/issues/19815)
<a name="5.0.1"></a> <a name="5.0.1"></a>
## [5.0.1](https://github.com/angular/angular/compare/5.0.0...5.0.1) (2017-11-08) ## [5.0.1](https://github.com/angular/angular/compare/5.0.0...5.0.1) (2017-11-08)

View File

@ -69,37 +69,36 @@ You can file new issues by filling out our [new issue form](https://github.com/a
### <a name="submit-pr"></a> Submitting a Pull Request (PR) ### <a name="submit-pr"></a> Submitting a Pull Request (PR)
Before you submit your Pull Request (PR) consider the following guidelines: Before you submit your Pull Request (PR) consider the following guidelines:
1. Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR * Search [GitHub](https://github.com/angular/angular/pulls) for an open or closed PR
that relates to your submission. You don't want to duplicate effort. that relates to your submission. You don't want to duplicate effort.
1. Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs. * Please sign our [Contributor License Agreement (CLA)](#cla) before sending PRs.
We cannot accept code without this. We cannot accept code without this.
1. Fork the angular/angular repo. * Make your changes in a new git branch:
1. Make your changes in a new git branch:
```shell ```shell
git checkout -b my-fix-branch master git checkout -b my-fix-branch master
``` ```
1. Create your patch, **including appropriate test cases**. * Create your patch, **including appropriate test cases**.
1. Follow our [Coding Rules](#rules). * Follow our [Coding Rules](#rules).
1. Run the full Angular test suite, as described in the [developer documentation][dev-doc], * Run the full Angular test suite, as described in the [developer documentation][dev-doc],
and ensure that all tests pass. and ensure that all tests pass.
1. Commit your changes using a descriptive commit message that follows our * Commit your changes using a descriptive commit message that follows our
[commit message conventions](#commit). Adherence to these conventions [commit message conventions](#commit). Adherence to these conventions
is necessary because release notes are automatically generated from these messages. is necessary because release notes are automatically generated from these messages.
```shell ```shell
git commit -a git commit -a
``` ```
Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files. Note: the optional commit `-a` command line option will automatically "add" and "rm" edited files.
1. Push your branch to GitHub: * Push your branch to GitHub:
```shell ```shell
git push origin my-fix-branch git push origin my-fix-branch
``` ```
1. In GitHub, send a pull request to `angular:master`. * In GitHub, send a pull request to `angular:master`.
* If we suggest changes then: * If we suggest changes then:
* Make the required updates. * Make the required updates.
* Re-run the Angular test suites to ensure tests are still passing. * Re-run the Angular test suites to ensure tests are still passing.

View File

@ -5,7 +5,8 @@ load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
git_repository( git_repository(
name = "build_bazel_rules_nodejs", name = "build_bazel_rules_nodejs",
remote = "https://github.com/bazelbuild/rules_nodejs.git", remote = "https://github.com/bazelbuild/rules_nodejs.git",
commit = "0.2.1", # TODO(alexeagle): use the correct tag here.
commit = "2c6243df53fd33fdab283ebdd01582e4eb815db8",
) )
load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories") load("@build_bazel_rules_nodejs//:defs.bzl", "node_repositories")

View File

@ -1,62 +0,0 @@
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"project": {
"name": "angular.io-example"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
// #docregion styles
"styles": [
"styles.css"
],
// #enddocregion styles
"scripts": [],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json",
"exclude": "**/node_modules/**"
},
{
"project": "src/tsconfig.spec.json",
"exclude": "**/node_modules/**"
},
{
"project": "e2e/tsconfig.e2e.json",
"exclude": "**/node_modules/**"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}

View File

@ -5,6 +5,9 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<title>AngularJS to Angular Quick Reference</title> <title>AngularJS to Angular Quick Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<!-- #docregion style -->
<link rel="stylesheet" href="styles.css">
<!-- #enddocregion style -->
</head> </head>
<body> <body>

View File

@ -4,7 +4,7 @@
"files":[ "files":[
"!**/*.d.ts", "!**/*.d.ts",
"!**/*.js", "!**/*.js",
"!app/*.[0,1,2,3].*" "!app/*.[1,2,3].*"
], ],
"tags": ["attribute", "directive"] "tags": ["attribute", "directive"]
} }

View File

@ -1,14 +1,14 @@
<!-- #docregion --> <!-- #docregion -->
<h1>My First Attribute Directive</h1> <h1>My First Attribute Directive</h1>
<!-- #docregion applied --> <!-- #docregion applied -->
<p appHighlight>Highlight me!</p> <p appHightlight>Highlight me!</p>
<!-- #enddocregion applied, --> <!-- #enddocregion applied, -->
<!-- #docregion color-1 --> <!-- #docregion color-1 -->
<p appHighlight highlightColor="yellow">Highlighted in yellow</p> <p appHightlight highlightColor="yellow">Highlighted in yellow</p>
<p appHighlight [highlightColor]="'orange'">Highlighted in orange</p> <p appHightlight [highlightColor]="'orange'">Highlighted in orange</p>
<!-- #enddocregion color-1 --> <!-- #enddocregion color-1 -->
<!-- #docregion color-2 --> <!-- #docregion color-2 -->
<p appHighlight [highlightColor]="color">Highlighted with parent component's color</p> <p appHightlight [highlightColor]="color">Highlighted with parent component's color</p>
<!-- #enddocregion color-2 --> <!-- #enddocregion color-2 -->

View File

@ -1,9 +0,0 @@
// #docregion
import { Directive } from '@angular/core';
@Directive({
selector: '[appHighlight]'
})
export class HighlightDirective {
constructor() { }
}

View File

@ -1,10 +1,8 @@
/* tslint:disable:no-unused-variable */ /* tslint:disable:no-unused-variable */
// #docregion // #docregion
import { Directive, ElementRef } from '@angular/core'; import { Directive, ElementRef, Input } from '@angular/core';
@Directive({ @Directive({ selector: '[appHighlight]' })
selector: '[appHighlight]'
})
export class HighlightDirective { export class HighlightDirective {
constructor(el: ElementRef) { constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'yellow'; el.nativeElement.style.backgroundColor = 'yellow';

View File

@ -1,10 +1,7 @@
/* tslint:disable:no-unused-variable member-ordering */ /* tslint:disable:no-unused-variable member-ordering */
// #docplaster // #docplaster
// #docregion imports,
import { Directive, ElementRef, HostListener } from '@angular/core';
// #enddocregion imports,
import { Input } from '@angular/core';
// #docregion // #docregion
import { Directive, ElementRef, HostListener, Input } from '@angular/core';
@Directive({ @Directive({
selector: '[appHighlight]' selector: '[appHighlight]'
@ -38,7 +35,7 @@ export class HighlightDirective {
// #enddocregion color // #enddocregion color
// #docregion color-2 // #docregion color-2
@Input() appHighlight: string; @Input() myHighlight: string;
// #enddocregion color-2 // #enddocregion color-2
} }

View File

@ -1,7 +1,6 @@
/* tslint:disable:member-ordering */ /* tslint:disable:member-ordering */
// #docregion, imports // #docregion
import { Directive, ElementRef, HostListener, Input } from '@angular/core'; import { Directive, ElementRef, HostListener, Input } from '@angular/core';
// #enddocregion imports
@Directive({ @Directive({
selector: '[appHighlight]' selector: '[appHighlight]'

View File

@ -1,5 +1,7 @@
/* tslint:disable:member-ordering */ /* tslint:disable:member-ordering */
// #docregion imports,
import { Directive, ElementRef, HostListener, Input } from '@angular/core'; import { Directive, ElementRef, HostListener, Input } from '@angular/core';
// #enddocregion imports
@Directive({ @Directive({
selector: '[appHighlight]' selector: '[appHighlight]'

View File

@ -4,8 +4,7 @@
"files":[ "files":[
"!**/*.d.ts", "!**/*.d.ts",
"!**/*.js", "!**/*.js",
"!**/*.[0,1,2].*", "!**/*.[1,2].*"
"**/dummy.module.ts"
], ],
"tags": ["dependency", "di"] "tags": ["dependency", "di"]
} }

View File

@ -1,10 +0,0 @@
/*
Must put this interface in its own file instead of app.config.ts
or else TypeScript gives a (bogus) warning:
WARNING in ./src/app/... .ts
"export 'AppConfig' was not found in './app.config'
*/
export interface AppConfig {
apiEndpoint: string;
title: string;
}

View File

@ -1,5 +1,7 @@
// Early versions
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',

View File

@ -1,6 +1,7 @@
// #docregion // #docregion
// #docregion imports // #docregion imports
import { Component, Inject } from '@angular/core'; import { Component } from '@angular/core';
import { Inject } from '@angular/core';
import { APP_CONFIG, AppConfig } from './app.config'; import { APP_CONFIG, AppConfig } from './app.config';
// #enddocregion imports // #enddocregion imports
@ -22,5 +23,3 @@ export class AppComponent {
} }
// #enddocregion ctor // #enddocregion ctor
} }
// #enddocregion

View File

@ -4,6 +4,7 @@
import { Component, Inject } from '@angular/core'; import { Component, Inject } from '@angular/core';
import { APP_CONFIG, AppConfig } from './app.config'; import { APP_CONFIG, AppConfig } from './app.config';
import { Logger } from './logger.service';
import { UserService } from './user.service'; import { UserService } from './user.service';
// #enddocregion imports // #enddocregion imports
@ -22,7 +23,8 @@ import { UserService } from './user.service';
<app-heroes id="authorized" *ngIf="isAuthorized"></app-heroes> <app-heroes id="authorized" *ngIf="isAuthorized"></app-heroes>
<app-heroes id="unauthorized" *ngIf="!isAuthorized"></app-heroes> <app-heroes id="unauthorized" *ngIf="!isAuthorized"></app-heroes>
<app-providers></app-providers> <app-providers></app-providers>
` `,
providers: [Logger]
}) })
export class AppComponent { export class AppComponent {
title: string; title: string;

View File

@ -1,13 +1,15 @@
import { AppConfig } from './app-config';
export { AppConfig } from './app-config';
// #docregion token // #docregion token
import { InjectionToken } from '@angular/core'; import { InjectionToken } from '@angular/core';
export const APP_CONFIG = new InjectionToken<AppConfig>('app.config'); export let APP_CONFIG = new InjectionToken<AppConfig>('app.config');
// #enddocregion token // #enddocregion token
// #docregion config // #docregion config
export interface AppConfig {
apiEndpoint: string;
title: string;
}
export const HERO_DI_CONFIG: AppConfig = { export const HERO_DI_CONFIG: AppConfig = {
apiEndpoint: 'api.heroes.com', apiEndpoint: 'api.heroes.com',
title: 'Dependency Injection' title: 'Dependency Injection'

View File

@ -1,24 +1,32 @@
// #docplaster
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { APP_CONFIG, HERO_DI_CONFIG } from './app.config';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { CarComponent } from './car/car.component'; import { CarComponent } from './car/car.component';
import { HeroesComponent } from './heroes/heroes.component'; import { HeroesComponent } from './heroes/heroes.component';
import { HeroListComponent } from './heroes/hero-list.component'; import { HeroListComponent } from './heroes/hero-list.component';
import { InjectorComponent } from './injector.component'; import { InjectorComponent } from './injector.component';
import { Logger } from './logger.service';
import { TestComponent } from './test.component'; import { TestComponent } from './test.component';
import { APP_CONFIG, HERO_DI_CONFIG } from './app.config';
import { UserService } from './user.service'; import { UserService } from './user.service';
import {
import { ProvidersModule } from './providers.module'; ProvidersComponent,
Provider1Component,
Provider3Component,
Provider4Component,
Provider5Component,
Provider6aComponent,
Provider6bComponent,
Provider7Component,
Provider8Component,
Provider9Component,
Provider10Component,
} from './providers.component';
// #docregion ngmodule // #docregion ngmodule
@NgModule({ @NgModule({
imports: [ imports: [
BrowserModule, BrowserModule
ProvidersModule
], ],
declarations: [ declarations: [
AppComponent, AppComponent,
@ -27,19 +35,26 @@ import { ProvidersModule } from './providers.module';
// #enddocregion ngmodule // #enddocregion ngmodule
HeroListComponent, HeroListComponent,
InjectorComponent, InjectorComponent,
TestComponent TestComponent,
ProvidersComponent,
Provider1Component,
Provider3Component,
Provider4Component,
Provider5Component,
Provider6aComponent,
Provider6bComponent,
Provider7Component,
Provider8Component,
Provider9Component,
Provider10Component,
// #docregion ngmodule // #docregion ngmodule
], ],
// #docregion providers, providers-2 // #docregion ngmodule-providers
providers: [ providers: [
// #enddocregion providers
Logger,
// #docregion providers
UserService, UserService,
{ provide: APP_CONFIG, useValue: HERO_DI_CONFIG } { provide: APP_CONFIG, useValue: HERO_DI_CONFIG }
], ],
// #enddocregion providers, providers-2 // #enddocregion ngmodule-providers
exports: [ CarComponent, HeroesComponent ],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) })
export class AppModule { } export class AppModule { }

View File

@ -1,25 +0,0 @@
/// Dummy modules to satisfy Angular Language Service
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { AppModule } from './app.module';
////////
import { AppComponent as AppComponent1 } from './app.component.1';
@NgModule({
imports: [ CommonModule, AppModule ],
declarations: [ AppComponent1 ]
})
export class DummyModule1 {}
/////////
import { AppComponent as AppComponent2 } from './app.component.2';
@NgModule({
imports: [ CommonModule, AppModule ],
declarations: [ AppComponent2 ]
})
export class DummyModule2 {}

View File

@ -1,35 +0,0 @@
/// Dummy modules to satisfy Angular Language Service
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
////////
import { HeroListComponent as HeroListComponent1 } from './hero-list.component.1';
@NgModule({
imports: [ CommonModule ],
declarations: [ HeroListComponent1 ],
exports: [ HeroListComponent1 ]
})
export class DummyModule1 {}
/////////
import { HeroListComponent as HeroListComponent2 } from './hero-list.component.2';
@NgModule({
imports: [ CommonModule ],
declarations: [ HeroListComponent2 ]
})
export class DummyModule2 {}
/////////
import { HeroesComponent as HeroesComponent1 } from './heroes.component.1';
@NgModule({
imports: [ CommonModule, DummyModule1 ],
declarations: [ HeroesComponent1 ]
})
export class DummyModule3 {}

View File

@ -1,17 +1,16 @@
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { HEROES } from './mock-heroes'; import { HEROES } from './mock-heroes';
@Component({ @Component({
selector: 'app-hero-list', selector: 'app-hero-list',
template: ` template: `
<div *ngFor="let hero of heroes"> <div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}} {{hero.id}} - {{hero.name}}
</div> </div>
` `
}) })
// #docregion class
export class HeroListComponent { export class HeroListComponent {
heroes = HEROES; heroes = HEROES;
} }
// #enddocregion class

View File

@ -1,6 +1,7 @@
// #docplaster // #docplaster
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Hero } from './hero'; import { Hero } from './hero';
// #enddocregion // #enddocregion
import { HeroService } from './hero.service.1'; import { HeroService } from './hero.service.1';
@ -14,9 +15,9 @@ import { HeroService } from './hero.service';
@Component({ @Component({
selector: 'app-hero-list', selector: 'app-hero-list',
template: ` template: `
<div *ngFor="let hero of heroes"> <div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}} {{hero.id}} - {{hero.name}}
</div> </div>
` `
}) })
export class HeroListComponent { export class HeroListComponent {

View File

@ -1,16 +1,17 @@
/* tslint:disable:one-line */ /* tslint:disable:one-line */
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Hero } from './hero'; import { Hero } from './hero';
import { HeroService } from './hero.service'; import { HeroService } from './hero.service';
@Component({ @Component({
selector: 'app-hero-list', selector: 'app-hero-list',
template: ` template: `
<div *ngFor="let hero of heroes"> <div *ngFor="let hero of heroes">
{{hero.id}} - {{hero.name}} {{hero.id}} - {{hero.name}}
({{hero.isSecret ? 'secret' : 'public'}}) ({{hero.isSecret ? 'secret' : 'public'}})
</div> </div>
`, `,
}) })
export class HeroListComponent { export class HeroListComponent {

View File

@ -1,6 +0,0 @@
import { Injectable } from '@angular/core';
@Injectable()
export class HeroService {
constructor() { }
}

View File

@ -1,5 +1,6 @@
// #docregion // #docregion
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HEROES } from './mock-heroes'; import { HEROES } from './mock-heroes';
@Injectable() @Injectable()

View File

@ -1,5 +1,6 @@
// #docregion // #docregion
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HEROES } from './mock-heroes'; import { HEROES } from './mock-heroes';
import { Logger } from '../logger.service'; import { Logger } from '../logger.service';

View File

@ -1,5 +1,6 @@
// #docregion // #docregion
import { Injectable } from '@angular/core'; import { Injectable } from '@angular/core';
import { HEROES } from './mock-heroes'; import { HEROES } from './mock-heroes';
import { Logger } from '../logger.service'; import { Logger } from '../logger.service';

View File

@ -1,18 +1,21 @@
// #docplaster // #docplaster
// #docregion, v1 // #docregion full, v1
import { Component } from '@angular/core'; import { Component } from '@angular/core';
// #enddocregion v1 // #enddocregion v1
import { HeroService } from './hero.service';
// #docregion v1 import { HeroService } from './hero.service';
// #enddocregion full
// #docregion full, v1
@Component({ @Component({
selector: 'app-heroes', selector: 'app-heroes',
// #enddocregion v1 // #enddocregion v1
providers: [ HeroService ], providers: [HeroService],
// #docregion v1 // #docregion v1
template: ` template: `
<h2>Heroes</h2> <h2>Heroes</h2>
<app-hero-list></app-hero-list> <app-hero-list></app-hero-list>
` `
}) })
export class HeroesComponent { } export class HeroesComponent { }

View File

@ -1,13 +1,14 @@
// #docregion // #docregion
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { heroServiceProvider } from './hero.service.provider'; import { heroServiceProvider } from './hero.service.provider';
@Component({ @Component({
selector: 'app-heroes', selector: 'app-heroes',
providers: [ heroServiceProvider ],
template: ` template: `
<h2>Heroes</h2> <h2>Heroes</h2>
<app-hero-list></app-hero-list> <app-hero-list></app-hero-list>
` `,
providers: [heroServiceProvider]
}) })
export class HeroesComponent { } export class HeroesComponent { }

View File

@ -1,21 +1,19 @@
/* /* tslint:disable:one-line:check-open-brace*/
* A collection of demo components showing different ways to provide services // Examples of provider arrays
* in @Component metadata // #docplaster
*/
import { Component, Inject, Injectable, OnInit } from '@angular/core'; import { Component, Inject, Injectable, OnInit } from '@angular/core';
import { import { APP_CONFIG, AppConfig,
APP_CONFIG, HERO_DI_CONFIG } from './app.config';
AppConfig,
HERO_DI_CONFIG } from './app.config';
import { HeroService } from './heroes/hero.service'; import { HeroService } from './heroes/hero.service';
import { heroServiceProvider } from './heroes/hero.service.provider'; import { heroServiceProvider } from './heroes/hero.service.provider';
import { Logger } from './logger.service'; import { Logger } from './logger.service';
import { UserService } from './user.service'; import { UserService } from './user.service';
const template = '{{log}}'; let template = '{{log}}';
//////////////////////////////////////////
@Component({ @Component({
selector: 'provider-1', selector: 'provider-1',
template: template, template: template,
@ -32,7 +30,6 @@ export class Provider1Component {
} }
////////////////////////////////////////// //////////////////////////////////////////
@Component({ @Component({
selector: 'provider-3', selector: 'provider-3',
template: template, template: template,
@ -50,7 +47,7 @@ export class Provider3Component {
} }
////////////////////////////////////////// //////////////////////////////////////////
export class BetterLogger extends Logger {} class BetterLogger extends Logger {}
@Component({ @Component({
selector: 'provider-4', selector: 'provider-4',
@ -69,10 +66,9 @@ export class Provider4Component {
} }
////////////////////////////////////////// //////////////////////////////////////////
// #docregion EvenBetterLogger // #docregion EvenBetterLogger
@Injectable() @Injectable()
export class EvenBetterLogger extends Logger { class EvenBetterLogger extends Logger {
constructor(private userService: UserService) { super(); } constructor(private userService: UserService) { super(); }
log(message: string) { log(message: string) {
@ -100,10 +96,8 @@ export class Provider5Component {
} }
////////////////////////////////////////// //////////////////////////////////////////
class NewLogger extends Logger {}
export class NewLogger extends Logger {} class OldLogger {
export class OldLogger {
logs: string[] = []; logs: string[] = [];
log(message: string) { log(message: string) {
throw new Error('Should not call the old logger!'); throw new Error('Should not call the old logger!');
@ -155,14 +149,11 @@ export class Provider6bComponent {
} }
////////////////////////////////////////// //////////////////////////////////////////
// #docregion silent-logger // #docregion silent-logger
// An object in the shape of the logger service // An object in the shape of the logger service
export function SilentLoggerFn() {} let silentLogger = {
const silentLogger = {
logs: ['Silent logger says "Shhhhh!". Provided via "useValue"'], logs: ['Silent logger says "Shhhhh!". Provided via "useValue"'],
log: SilentLoggerFn log: () => {}
}; };
// #enddocregion silent-logger // #enddocregion silent-logger
@ -181,7 +172,6 @@ export class Provider7Component {
this.log = logger.logs[0]; this.log = logger.logs[0];
} }
} }
///////////////// /////////////////
@Component({ @Component({
@ -199,7 +189,6 @@ export class Provider8Component {
} }
///////////////// /////////////////
@Component({ @Component({
selector: 'provider-9', selector: 'provider-9',
template: template, template: template,
@ -229,7 +218,6 @@ export class Provider9Component implements OnInit {
this.log = 'APP_CONFIG Application title is ' + this.config.title; this.log = 'APP_CONFIG Application title is ' + this.config.title;
} }
} }
////////////////////////////////////////// //////////////////////////////////////////
// Sample providers 1 to 7 illustrate a required logger dependency. // Sample providers 1 to 7 illustrate a required logger dependency.
// Optional logger, can be null // Optional logger, can be null
@ -260,7 +248,6 @@ export class Provider10Component implements OnInit {
} }
///////////////// /////////////////
@Component({ @Component({
selector: 'app-providers', selector: 'app-providers',
template: ` template: `

View File

@ -1,33 +0,0 @@
import { NgModule } from '@angular/core';
import {
Provider1Component,
Provider3Component,
Provider4Component,
Provider5Component,
Provider6aComponent,
Provider6bComponent,
Provider7Component,
Provider8Component,
Provider9Component,
Provider10Component,
ProvidersComponent,
} from './providers.component';
@NgModule({
declarations: [
Provider1Component,
Provider3Component,
Provider4Component,
Provider5Component,
Provider6aComponent,
Provider6bComponent,
Provider7Component,
Provider8Component,
Provider9Component,
Provider10Component,
ProvidersComponent,
],
exports: [ ProvidersComponent ]
})
export class ProvidersModule {}

View File

@ -2,11 +2,10 @@
// Simulate a simple test // Simulate a simple test
// Reader should look to the testing chapter for the real thing // Reader should look to the testing chapter for the real thing
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Hero } from './heroes/hero'; import { HeroService } from './heroes/hero.service';
import { HeroService } from './heroes/hero.service'; import { HeroListComponent } from './heroes/hero-list.component';
import { HeroListComponent } from './heroes/hero-list.component';
@Component({ @Component({
selector: 'app-tests', selector: 'app-tests',
@ -23,13 +22,12 @@ export class TestComponent {
function runTests() { function runTests() {
// #docregion spec // #docregion spec
const expectedHeroes = [{name: 'A'}, {name: 'B'}] let expectedHeroes = [{name: 'A'}, {name: 'B'}]
const mockService = <HeroService> {getHeroes: () => expectedHeroes } let mockService = <HeroService> {getHeroes: () => expectedHeroes }
it('should have heroes when HeroListComponent created', () => { it('should have heroes when HeroListComponent created', () => {
// Pass the mock to the constructor as the Angular injector would let hlc = new HeroListComponent(mockService);
const component = new HeroListComponent(mockService); expect(hlc.heroes.length).toEqual(expectedHeroes.length);
expect(component.heroes.length).toEqual(expectedHeroes.length);
}); });
// #enddocregion spec // #enddocregion spec

View File

@ -1 +0,0 @@
<app-hero-form></app-hero-form>

View File

@ -3,7 +3,6 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', template: '<app-hero-form></app-hero-form>'
styleUrls: ['./app.component.css']
}) })
export class AppComponent { } export class AppComponent { }

View File

@ -4,7 +4,7 @@ import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HeroFormComponent } from './hero-form/hero-form.component'; import { HeroFormComponent } from './hero-form.component';
@NgModule({ @NgModule({
imports: [ imports: [
@ -15,7 +15,6 @@ import { HeroFormComponent } from './hero-form/hero-form.component';
AppComponent, AppComponent,
HeroFormComponent HeroFormComponent
], ],
providers: [],
bootstrap: [ AppComponent ] bootstrap: [ AppComponent ]
}) })
export class AppModule { } export class AppModule { }

View File

@ -2,12 +2,11 @@
// #docregion , v1, final // #docregion , v1, final
import { Component } from '@angular/core'; import { Component } from '@angular/core';
import { Hero } from '../hero'; import { Hero } from './hero';
@Component({ @Component({
selector: 'app-hero-form', selector: 'app-hero-form',
templateUrl: './hero-form.component.html', templateUrl: './hero-form.component.html'
styleUrls: ['./hero-form.component.css']
}) })
export class HeroFormComponent { export class HeroFormComponent {

View File

@ -1 +0,0 @@
@import url('https://unpkg.com/bootstrap@3.3.7/dist/css/bootstrap.min.css');

View File

@ -93,20 +93,22 @@ export class AfterContentComponent implements AfterContentChecked, AfterContentI
<h4>-- AfterContent Logs --</h4> <h4>-- AfterContent Logs --</h4>
<p><button (click)="reset()">Reset</button></p> <p><button (click)="reset()">Reset</button></p>
<div *ngFor="let msg of logger.logs">{{msg}}</div> <div *ngFor="let msg of logs">{{msg}}</div>
</div> </div>
`, `,
styles: ['.parent {background: burlywood}'], styles: ['.parent {background: burlywood}'],
providers: [LoggerService] providers: [LoggerService]
}) })
export class AfterContentParentComponent { export class AfterContentParentComponent {
logs: string[];
show = true; show = true;
constructor(public logger: LoggerService) { constructor(private logger: LoggerService) {
this.logs = logger.logs;
} }
reset() { reset() {
this.logger.clear(); this.logs.length = 0;
// quickly remove and reload AfterContentComponent which recreates it // quickly remove and reload AfterContentComponent which recreates it
this.show = false; this.show = false;
this.logger.tick_then(() => this.show = true); this.logger.tick_then(() => this.show = true);

View File

@ -95,20 +95,22 @@ export class AfterViewComponent implements AfterViewChecked, AfterViewInit {
<h4>-- AfterView Logs --</h4> <h4>-- AfterView Logs --</h4>
<p><button (click)="reset()">Reset</button></p> <p><button (click)="reset()">Reset</button></p>
<div *ngFor="let msg of logger.logs">{{msg}}</div> <div *ngFor="let msg of logs">{{msg}}</div>
</div> </div>
`, `,
styles: ['.parent {background: burlywood}'], styles: ['.parent {background: burlywood}'],
providers: [LoggerService] providers: [LoggerService]
}) })
export class AfterViewParentComponent { export class AfterViewParentComponent {
logs: string[];
show = true; show = true;
constructor(public logger: LoggerService) { constructor(private logger: LoggerService) {
this.logs = logger.logs;
} }
reset() { reset() {
this.logger.clear(); this.logs.length = 0;
// quickly remove and reload AfterViewComponent which recreates it // quickly remove and reload AfterViewComponent which recreates it
this.show = false; this.show = false;
this.logger.tick_then(() => this.show = true); this.logger.tick_then(() => this.show = true);

View File

@ -27,7 +27,7 @@ export class MyCounterComponent implements OnChanges {
// Empty the changeLog whenever counter goes to zero // Empty the changeLog whenever counter goes to zero
// hint: this is a way to respond programmatically to external value changes. // hint: this is a way to respond programmatically to external value changes.
if (this.counter === 0) { if (this.counter === 0) {
this.changeLog = []; this.changeLog.length = 0;
} }
// A change to `counter` is the only change we care about // A change to `counter` is the only change we care about

View File

@ -68,7 +68,7 @@ export class DoCheckComponent implements DoCheck {
reset() { reset() {
this.changeDetected = true; this.changeDetected = true;
this.changeLog = []; this.changeLog.length = 0;
} }
} }

View File

@ -18,7 +18,7 @@ export class LoggerService {
} }
} }
clear() { this.logs = []; } clear() { this.logs.length = 0; }
// schedules a view refresh to ensure display catches up // schedules a view refresh to ensure display catches up
tick() { this.tick_then(() => { }); } tick() { this.tick_then(() => { }); }

View File

@ -43,7 +43,7 @@ export class OnChangesComponent implements OnChanges {
} }
// #enddocregion ng-on-changes // #enddocregion ng-on-changes
reset() { this.changeLog = []; } reset() { this.changeLog.length = 0; }
} }
/***************************************/ /***************************************/

View File

@ -12,5 +12,5 @@
</div> </div>
<!-- #enddocregion template --> <!-- #enddocregion template -->
<h4>-- Spy Lifecycle Hook Log --</h4> <h4>-- Spy Lifecycle Hook Log --</h4>
<div *ngFor="let msg of logger.logs">{{msg}}</div> <div *ngFor="let msg of spyLog">{{msg}}</div>
</div> </div>

View File

@ -15,8 +15,10 @@ import { LoggerService } from './logger.service';
export class SpyParentComponent { export class SpyParentComponent {
newName = 'Herbie'; newName = 'Herbie';
heroes: string[] = ['Windstorm', 'Magneta']; heroes: string[] = ['Windstorm', 'Magneta'];
spyLog: string[];
constructor(public logger: LoggerService) { constructor(private logger: LoggerService) {
this.spyLog = logger.logs;
} }
addHero() { addHero() {
@ -32,7 +34,7 @@ export class SpyParentComponent {
} }
reset() { reset() {
this.logger.log('-- reset --'); this.logger.log('-- reset --');
this.heroes = []; this.heroes.length = 0;
this.logger.tick(); this.logger.tick();
} }
} }

View File

@ -14,7 +14,7 @@
"app/contact/contact.component.html", "app/contact/contact.component.html",
"app/contact/contact.component.3.ts", "app/contact/contact.component.3.ts",
"app/contact/contact.service.ts", "app/contact/contact.service.ts",
"app/contact/contact-highlight.directive.ts", "app/contact/highlight.directive.ts",
"main.1b.ts", "main.1b.ts",
"styles.css", "styles.css",

View File

@ -16,7 +16,7 @@
"app/contact/awesome.pipe.ts", "app/contact/awesome.pipe.ts",
"app/contact/contact.component.3.ts", "app/contact/contact.component.3.ts",
"app/contact/contact.module.2.ts", "app/contact/contact.module.2.ts",
"app/contact/contact-highlight.directive.ts", "app/contact/highlight.directive.ts",
"main.2.ts", "main.2.ts",
"styles.css", "styles.css",

View File

@ -15,7 +15,7 @@ describe('NgModule', function () {
return { return {
title: element.all(by.tagName('h1')).get(0), title: element.all(by.tagName('h1')).get(0),
welcome: element.all(by.css('app-title p i')).get(0), subtitle: element.all(by.css('app-title p i')).get(0),
contactButton: buttons.get(0), contactButton: buttons.get(0),
crisisButton: buttons.get(1), crisisButton: buttons.get(1),
heroesButton: buttons.get(2) heroesButton: buttons.get(2)
@ -67,7 +67,7 @@ describe('NgModule', function () {
it('should welcome us', function () { it('should welcome us', function () {
const commons = getCommonsSectionStruct(); const commons = getCommonsSectionStruct();
expect(commons.welcome.getText()).toBe('Welcome, ' + (name || 'Sherlock Holmes')); expect(commons.subtitle.getText()).toBe('Welcome, ' + (name || 'Sherlock Holmes'));
}); });
}; };
} }

View File

@ -19,7 +19,7 @@
"app/contact/contact.component.3.ts", "app/contact/contact.component.3.ts",
"app/contact/contact.module.3.ts", "app/contact/contact.module.3.ts",
"app/contact/contact-routing.module.3.ts", "app/contact/contact-routing.module.3.ts",
"app/contact/contact-highlight.directive.ts", "app/contact/highlight.directive.ts",
"app/crisis/*.ts", "app/crisis/*.ts",

View File

@ -1,19 +1,14 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { ContactModule } from './contact/contact.module.3'; export const routes: Routes = [
const routes: Routes = [
{ path: '', redirectTo: 'contact', pathMatch: 'full'}, { path: '', redirectTo: 'contact', pathMatch: 'full'},
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' }, { path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' },
{ path: 'heroes', loadChildren: 'app/hero/hero.module.3#HeroModule' } { path: 'heroes', loadChildren: 'app/hero/hero.module.3#HeroModule' }
]; ];
@NgModule({ @NgModule({
imports: [ imports: [RouterModule.forRoot(routes)],
ContactModule,
RouterModule.forRoot(routes)
],
exports: [RouterModule] exports: [RouterModule]
}) })
export class AppRoutingModule {} export class AppRoutingModule {}

View File

@ -2,29 +2,18 @@
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router'; import { Routes, RouterModule } from '@angular/router';
import { ContactModule } from './contact/contact.module'; export const routes: Routes = [
// #docregion routes
const routes: Routes = [
{ path: '', redirectTo: 'contact', pathMatch: 'full'}, { path: '', redirectTo: 'contact', pathMatch: 'full'},
// #docregion lazy-routes // #docregion lazy-routes
{ path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' }, { path: 'crisis', loadChildren: 'app/crisis/crisis.module#CrisisModule' },
{ path: 'heroes', loadChildren: 'app/hero/hero.module#HeroModule' } { path: 'heroes', loadChildren: 'app/hero/hero.module#HeroModule' }
// #enddocregion lazy-routes // #enddocregion lazy-routes
]; ];
// #enddocregion routes
// #docregion forRoot
@NgModule({ @NgModule({
// #docregion imports imports: [RouterModule.forRoot(routes)],
imports: [
ContactModule,
// #docregion forRoot
RouterModule.forRoot(routes),
// #enddocregion forRoot
],
// #enddocregion imports
// #docregion exports
exports: [RouterModule] exports: [RouterModule]
// #enddocregion exports
}) })
export class AppRoutingModule {} export class AppRoutingModule {}
// #enddocregion forRoot

View File

@ -6,5 +6,5 @@ import { Component } from '@angular/core';
template: '<h1>{{title}}</h1>', template: '<h1>{{title}}</h1>',
}) })
export class AppComponent { export class AppComponent {
title = 'Angular Modules'; title = 'Minimal NgModule';
} }

View File

@ -11,7 +11,9 @@ import { Component } from '@angular/core';
// #enddocregion template // #enddocregion template
*/ */
// #docregion // #docregion
template: '<app-title></app-title>' template: '<app-title [subtitle]="subtitle"></app-title>'
}) })
export class AppComponent {} export class AppComponent {
subtitle = '(v1)';
}
// #enddocregion // #enddocregion

View File

@ -5,9 +5,11 @@ import { Component } from '@angular/core';
selector: 'app-root', selector: 'app-root',
// #docregion template // #docregion template
template: ` template: `
<app-title></app-title> <app-title [subtitle]="subtitle"></app-title>
<app-contact></app-contact> <app-contact></app-contact>
` `
// #enddocregion template // #enddocregion template
}) })
export class AppComponent {} export class AppComponent {
subtitle = '(v1)';
}

View File

@ -3,8 +3,10 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
template: ` template: `
<app-title></app-title> <app-title [subtitle]="subtitle"></app-title>
<app-contact></app-contact> <app-contact></app-contact>
` `
}) })
export class AppComponent {} export class AppComponent {
subtitle = '(v2)';
}

View File

@ -4,7 +4,7 @@ import { Component } from '@angular/core';
selector: 'app-root', selector: 'app-root',
// #docregion template // #docregion template
template: ` template: `
<app-title></app-title> <app-title [subtitle]="subtitle"></app-title>
<nav> <nav>
<a routerLink="contact" routerLinkActive="active">Contact</a> <a routerLink="contact" routerLinkActive="active">Contact</a>
<a routerLink="crisis" routerLinkActive="active">Crisis Center</a> <a routerLink="crisis" routerLinkActive="active">Crisis Center</a>
@ -14,4 +14,6 @@ import { Component } from '@angular/core';
` `
// #enddocregion template // #enddocregion template
}) })
export class AppComponent {} export class AppComponent {
subtitle = '(v3)';
}

View File

@ -5,7 +5,7 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
template: ` template: `
<app-title></app-title> <app-title [subtitle]="subtitle"></app-title>
<nav> <nav>
<a routerLink="contact" routerLinkActive="active">Contact</a> <a routerLink="contact" routerLinkActive="active">Contact</a>
<a routerLink="crisis" routerLinkActive="active">Crisis Center</a> <a routerLink="crisis" routerLinkActive="active">Crisis Center</a>
@ -14,4 +14,6 @@ import { Component } from '@angular/core';
<router-outlet></router-outlet> <router-outlet></router-outlet>
` `
}) })
export class AppComponent {} export class AppComponent {
subtitle = '(Final)';
}

View File

@ -1,7 +1,17 @@
// #docplaster
// #docregion
import { NgModule } 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.0'; import
// #enddocregion
{ AppComponent } from './app.component.0';
/*
// #docregion
{ AppComponent } from './app.component';
// #enddocregion
*/
// #docregion
@NgModule({ @NgModule({
// #docregion imports // #docregion imports

View File

@ -1,15 +1,14 @@
// #docplaster // #docplaster
// #docregion // #docregion
/* Angular Imports */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
/* App Imports */ import
// #enddocregion // #enddocregion
import { AppComponent } from './app.component.1'; { AppComponent } from './app.component.1';
/* /*
// #docregion // #docregion
import { AppComponent } from './app.component'; { AppComponent } from './app.component';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion
@ -22,9 +21,12 @@ import { FormsModule } from '@angular/forms';
import { AwesomePipe } from './contact/awesome.pipe'; import { AwesomePipe } from './contact/awesome.pipe';
import { ContactComponent } from './contact/contact.component.3'; import { ContactComponent } from './contact/contact.component.3';
// #docregion import-contact-directive
import { import {
ContactHighlightDirective as ContactHighlightDirective HighlightDirective as ContactHighlightDirective
} from './contact/contact-highlight.directive'; } from './contact/highlight.directive';
// #enddocregion import-contact-directive
@NgModule({ @NgModule({
// #docregion imports // #docregion imports

View File

@ -1,16 +1,15 @@
// #docplaster // #docplaster
// #docregion // #docregion
/* Angular Imports */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
/* App Imports */ /* App Root */
import
// #enddocregion // #enddocregion
import { AppComponent } from './app.component.1b'; { AppComponent } from './app.component.1b';
/* /*
// #docregion // #docregion
import { AppComponent } from './app.component'; { AppComponent } from './app.component';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion
@ -19,17 +18,25 @@ import { TitleComponent } from './title.component';
import { UserService } from './user.service'; import { UserService } from './user.service';
/* Contact Imports */ /* Contact Imports */
import
// #enddocregion // #enddocregion
import { ContactComponent } from './contact/contact.component.3'; { ContactComponent } from './contact/contact.component.3';
/* /*
// #docregion // #docregion
import { ContactComponent } from './contact/contact.component'; { ContactComponent } from './contact/contact.component';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion
import { AwesomePipe } from './contact/awesome.pipe'; import { ContactService } from './contact/contact.service';
import { ContactService } from './contact/contact.service'; import { AwesomePipe } from './contact/awesome.pipe';
import { ContactHighlightDirective } from './contact/contact-highlight.directive';
// #docregion import-alias
import {
HighlightDirective as ContactHighlightDirective
} from './contact/highlight.directive';
// #enddocregion import-alias
import { FormsModule } from '@angular/forms';
@NgModule({ @NgModule({
imports: [ BrowserModule, FormsModule ], imports: [ BrowserModule, FormsModule ],

View File

@ -1,15 +1,15 @@
// #docplaster // #docplaster
// #docregion // #docregion
/* Angular Imports */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
/* App Imports */ /* App Root */
import
// #enddocregion // #enddocregion
import { AppComponent } from './app.component.2'; { AppComponent } from './app.component.2';
/* /*
// #docregion // #docregion
import { AppComponent } from './app.component'; { AppComponent } from './app.component';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion
@ -18,11 +18,12 @@ import { TitleComponent } from './title.component';
import { UserService } from './user.service'; import { UserService } from './user.service';
/* Contact Imports */ /* Contact Imports */
import
// #enddocregion // #enddocregion
import { ContactModule } from './contact/contact.module.2'; { ContactModule } from './contact/contact.module.2';
/* /*
// #docregion // #docregion
import { ContactModule } from './contact/contact.module'; { ContactModule } from './contact/contact.module';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion

View File

@ -1,36 +1,25 @@
// #docplaster // #docplaster
// #docregion // #docregion
/* Angular Imports */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
/* App Imports */ /* App Root */
// #enddocregion
import { AppComponent } from './app.component.3'; import { AppComponent } from './app.component.3';
/*
// #docregion
import { AppComponent } from './app.component';
// #enddocregion
*/
// #docregion
import { HighlightDirective } from './highlight.directive'; import { HighlightDirective } from './highlight.directive';
import { TitleComponent } from './title.component'; import { TitleComponent } from './title.component';
import { UserService } from './user.service'; import { UserService } from './user.service';
/* Feature Modules */
import { ContactModule } from './contact/contact.module.3';
/* Routing Module */ /* Routing Module */
// #enddocregion
import { AppRoutingModule } from './app-routing.module.3'; import { AppRoutingModule } from './app-routing.module.3';
/*
// #docregion
import { AppRoutingModule } from './app-routing.module';
// #enddocregion
*/
// #docregion
@NgModule({ @NgModule({
// #docregion imports // #docregion imports
imports: [ imports: [
BrowserModule, BrowserModule,
ContactModule,
AppRoutingModule AppRoutingModule
], ],
// #enddocregion imports // #enddocregion imports

View File

@ -1,14 +1,14 @@
// #docplaster // #docplaster
// #docregion // #docregion
// #docregion v4 // #docregion v4
/* Angular Imports */
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser'; import { BrowserModule } from '@angular/platform-browser';
/* App Imports */ /* App Root */
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
/* Core Modules */ /* Feature Modules */
import { ContactModule } from './contact/contact.module';
import { CoreModule } from './core/core.module'; import { CoreModule } from './core/core.module';
/* Routing Module */ /* Routing Module */
@ -18,6 +18,7 @@ import { AppRoutingModule } from './app-routing.module';
// #docregion import-for-root // #docregion import-for-root
imports: [ imports: [
BrowserModule, BrowserModule,
ContactModule,
// #enddocregion v4 // #enddocregion v4
// #enddocregion import-for-root // #enddocregion import-for-root
/* /*

View File

@ -3,12 +3,10 @@ import { RouterModule } from '@angular/router';
import { ContactComponent } from './contact.component.3'; import { ContactComponent } from './contact.component.3';
const routes = [
{ path: 'contact', component: ContactComponent}
];
@NgModule({ @NgModule({
imports: [ RouterModule.forChild(routes) ], imports: [RouterModule.forChild([
exports: [ RouterModule ] { path: 'contact', component: ContactComponent}
])],
exports: [RouterModule]
}) })
export class ContactRoutingModule {} export class ContactRoutingModule {}

View File

@ -4,13 +4,11 @@ import { RouterModule } from '@angular/router';
import { ContactComponent } from './contact.component'; import { ContactComponent } from './contact.component';
// #docregion routing // #docregion routing
const routes = [
{ path: 'contact', component: ContactComponent}
];
@NgModule({ @NgModule({
imports: [ RouterModule.forChild(routes) ], imports: [RouterModule.forChild([
exports: [ RouterModule ] { path: 'contact', component: ContactComponent }
])],
exports: [RouterModule]
}) })
export class ContactRoutingModule {} export class ContactRoutingModule {}
// #enddocregion // #enddocregion

View File

@ -21,7 +21,7 @@ export class ContactComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.contactService.getContacts().subscribe(contacts => { this.contactService.getContacts().then(contacts => {
this.msg = ''; this.msg = '';
this.contacts = contacts; this.contacts = contacts;
this.contact = contacts[0]; this.contact = contacts[0];

View File

@ -27,6 +27,3 @@
margin-bottom: 20px; margin-bottom: 20px;
} }
.button-group {
padding-top: 12px;
}

View File

@ -6,32 +6,18 @@
<!-- #docregion awesome --> <!-- #docregion awesome -->
<h3 highlight>{{ contact.name | awesome }}</h3> <h3 highlight>{{ contact.name | awesome }}</h3>
<!-- #enddocregion awesome --> <!-- #enddocregion awesome -->
<div class="form-group"> <div class="form-group">
<label for="name">Name</label> <label for="name">Name</label>
<!-- #docregion ngModel -->
<input type="text" class="form-control" required <input type="text" class="form-control" required
[(ngModel)]="contact.name" [(ngModel)]="contact.name"
name="name" #name="ngModel" > name="name" #name="ngModel" >
<!-- #enddocregion ngModel -->
<div [hidden]="name.valid" class="alert alert-danger"> <div [hidden]="name.valid" class="alert alert-danger">
Name is required Name is required
</div> </div>
</div> </div>
<br>
<div class="button-group"> <button type="submit" class="btn btn-default" [disabled]="!contactForm.form.valid">Save</button>
<button type="submit" class="btn btn-default" <button type="button" class="btn" (click)="next()" [disabled]="!contactForm.form.valid">Next Contact</button>
[disabled]="!contactForm.form.valid"> <button type="button" class="btn" (click)="newContact()">New Contact</button>
Save</button>
<button type="button" class="btn" (click)="next()"
[disabled]="!contactForm.form.valid">
Next Contact</button>
<button type="button" class="btn" (click)="newContact()">
New Contact</button>
</div>
</form> </form>
<!-- #enddocregion --> <!-- #enddocregion -->

View File

@ -22,7 +22,7 @@ export class ContactComponent implements OnInit {
} }
ngOnInit() { ngOnInit() {
this.contactService.getContacts().subscribe(contacts => { this.contactService.getContacts().then(contacts => {
this.msg = ''; this.msg = '';
this.contacts = contacts; this.contacts = contacts;
this.contact = contacts[0]; this.contact = contacts[0];

View File

@ -1,11 +0,0 @@
// #docregion
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
@NgModule({
imports: [
CommonModule
],
declarations: []
})
export class ContactModule { }

View File

@ -5,32 +5,25 @@ import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { AwesomePipe } from './awesome.pipe'; import { AwesomePipe } from './awesome.pipe';
import
// #enddocregion // #enddocregion
import { ContactComponent } from './contact.component.3'; { ContactComponent } from './contact.component.3';
/* /*
// #docregion // #docregion
import { ContactComponent } from './contact.component'; { ContactComponent } from './contact.component';
// #enddocregion // #enddocregion
*/ */
// #docregion // #docregion
import { ContactHighlightDirective } from './contact-highlight.directive';
import { ContactService } from './contact.service'; import { ContactService } from './contact.service';
import { HighlightDirective } from './highlight.directive';
// #docregion class // #docregion class
@NgModule({ @NgModule({
imports: [ imports: [ CommonModule, FormsModule ],
CommonModule, declarations: [ ContactComponent, HighlightDirective, AwesomePipe ],
FormsModule exports: [ ContactComponent ],
], providers: [ ContactService ]
declarations: [
AwesomePipe,
ContactComponent,
ContactHighlightDirective
],
// #docregion exports
exports: [ ContactComponent ],
// #enddocregion exports
providers: [ ContactService ]
}) })
export class ContactModule { } export class ContactModule { }
// #enddocregion class // #enddocregion class

View File

@ -1,43 +1,21 @@
// #docplaster
// #docregion // #docregion
import { NgModule } from '@angular/core'; import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common'; import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { AwesomePipe } from './awesome.pipe'; import { AwesomePipe } from './awesome.pipe';
// #enddocregion
import { ContactComponent } from './contact.component.3';
/*
// #docregion
import { ContactComponent } from './contact.component';
// #enddocregion
*/
// #docregion
import { ContactHighlightDirective } from './contact-highlight.directive';
import { ContactService } from './contact.service';
// #enddocregion import { ContactComponent } from './contact.component.3';
import { ContactService } from './contact.service';
import { HighlightDirective } from './highlight.directive';
import { ContactRoutingModule } from './contact-routing.module.3'; import { ContactRoutingModule } from './contact-routing.module.3';
/*
// #docregion
import { ContactRoutingModule } from './contact-routing.module';
// #enddocregion
*/
// #docregion
// #docregion class // #docregion class
@NgModule({ @NgModule({
imports: [ imports: [ CommonModule, FormsModule, ContactRoutingModule ],
CommonModule, declarations: [ ContactComponent, HighlightDirective, AwesomePipe ],
FormsModule, providers: [ ContactService ]
ContactRoutingModule
],
declarations: [
AwesomePipe,
ContactComponent,
ContactHighlightDirective
],
providers: [ ContactService ]
}) })
export class ContactModule { } export class ContactModule { }
// #enddocregion class // #enddocregion class

View File

@ -8,10 +8,7 @@ import { ContactRoutingModule } from './contact-routing.module';
// #docregion class // #docregion class
@NgModule({ @NgModule({
imports: [ imports: [ SharedModule, ContactRoutingModule ],
SharedModule,
ContactRoutingModule
],
declarations: [ ContactComponent ], declarations: [ ContactComponent ],
providers: [ ContactService ] providers: [ ContactService ]
}) })

View File

@ -1,10 +1,5 @@
// #docplaster
// #docregion // #docregion
import { Injectable, OnDestroy } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operators';
export class Contact { export class Contact {
constructor(public id: number, public name: string) { } constructor(public id: number, public name: string) { }
@ -18,21 +13,17 @@ const CONTACTS: Contact[] = [
const FETCH_LATENCY = 500; const FETCH_LATENCY = 500;
/** Simulate a data service that retrieves contacts from a server */
@Injectable() @Injectable()
export class ContactService implements OnDestroy { export class ContactService {
// #enddocregion
constructor() { console.log('ContactService instance created.'); }
ngOnDestroy() { console.log('ContactService instance destroyed.'); }
// #docregion getContacts() {
getContacts(): Observable<Contact[]> { return new Promise<Contact[]>(resolve => {
return of(CONTACTS).pipe(delay(FETCH_LATENCY)); setTimeout(() => { resolve(CONTACTS); }, FETCH_LATENCY);
});
} }
getContact(id: number | string): Observable<Contact> { getContact(id: number | string) {
return of(CONTACTS.find(contact => contact.id === +id)) return this.getContacts()
.pipe(delay(FETCH_LATENCY)); .then(heroes => heroes.find(hero => hero.id === +id));
} }
} }
// #enddocregion

View File

@ -1,4 +1,4 @@
// #docplaster /* tslint:disable */
// Same directive name and selector as // Same directive name and selector as
// HighlightDirective in parent AppModule // HighlightDirective in parent AppModule
// It selects for both input boxes and 'highlight' attr // It selects for both input boxes and 'highlight' attr
@ -7,14 +7,12 @@
// #docregion // #docregion
import { Directive, ElementRef } from '@angular/core'; import { Directive, ElementRef } from '@angular/core';
// Highlight the host element or any InputElement in blue
@Directive({ selector: '[highlight], input' }) @Directive({ selector: '[highlight], input' })
export class ContactHighlightDirective { /** Highlight the attached element or an InputElement in blue */
export class HighlightDirective {
constructor(el: ElementRef) { constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'powderblue'; el.nativeElement.style.backgroundColor = 'powderblue';
// #enddocregion console.log(
console.log(`* Contact highlight called for ${el.nativeElement.tagName}`); `* Contact highlight called for ${el.nativeElement.tagName}`);
// #docregion
} }
} }
// #enddocregion

View File

@ -1,5 +1,5 @@
<!-- Exact copy from earlier app.component.html --> <!-- Exact copy from earlier app.component.html -->
<h1 highlight>{{title}}</h1> <h1 highlight>{{title}} {{subtitle}}</h1>
<p *ngIf="user"> <p *ngIf="user">
<i>Welcome, {{user}}</i> <i>Welcome, {{user}}</i>
<p> <p>

View File

@ -7,6 +7,7 @@ import { UserService } from '../core/user.service';
templateUrl: './title.component.html', templateUrl: './title.component.html',
}) })
export class TitleComponent { export class TitleComponent {
@Input() subtitle = '';
title = 'Angular Modules'; title = 'Angular Modules';
user = ''; user = '';

View File

@ -1,21 +1,22 @@
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Crisis, import { Crisis,
CrisisService } from './crisis.service'; CrisisService } from './crisis.service';
@Component({ @Component({
template: ` template: `
<h3 highlight>Crisis List</h3> <h3 highlight>Crisis List</h3>
<div *ngFor='let crisis of crises | async'> <div *ngFor='let crisis of crisises | async'>
<a routerLink="{{'../' + crisis.id}}">{{crisis.id}} - {{crisis.name}}</a> <a routerLink="{{'../' + crisis.id}}">{{crisis.id}} - {{crisis.name}}</a>
</div> </div>
` `
}) })
export class CrisisListComponent { export class CrisisListComponent implements OnInit {
crises: Observable<Crisis[]>; crisises: Promise<Crisis[]>;
constructor(private crisisService: CrisisService) { constructor(private crisisService: CrisisService) { }
this.crises = this.crisisService.getCrises();
ngOnInit() {
this.crisises = this.crisisService.getCrises();
} }
} }

View File

@ -1,8 +1,4 @@
import { Injectable, OnDestroy } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operators';
export class Crisis { export class Crisis {
constructor(public id: number, public name: string) { } constructor(public id: number, public name: string) { }
@ -17,18 +13,18 @@ const CRISES: Crisis[] = [
const FETCH_LATENCY = 500; const FETCH_LATENCY = 500;
/** Simulate a data service that retrieves crises from a server */
@Injectable() @Injectable()
export class CrisisService implements OnDestroy { export class CrisisService {
constructor() { console.log('CrisisService instance created.'); }
ngOnDestroy() { console.log('CrisisService instance destroyed.'); }
getCrises(): Observable<Crisis[]> { getCrises() {
return of(CRISES).pipe(delay(FETCH_LATENCY)); return new Promise<Crisis[]>(resolve => {
setTimeout(() => { resolve(CRISES); }, FETCH_LATENCY);
});
} }
getCrisis(id: number | string): Observable<Crisis> { getCrisis(id: number | string) {
return of(CRISES.find(crisis => crisis.id === +id)) return this.getCrises()
.pipe(delay(FETCH_LATENCY)); .then(heroes => heroes.find(hero => hero.id === +id));
} }
} }

View File

@ -26,6 +26,6 @@ export class HeroDetailComponent implements OnInit {
ngOnInit() { ngOnInit() {
let id = parseInt(this.route.snapshot.paramMap.get('id'), 10); let id = parseInt(this.route.snapshot.paramMap.get('id'), 10);
this.heroService.getHero(id).subscribe(hero => this.hero = hero); this.heroService.getHero(id).then(hero => this.hero = hero);
} }
} }

View File

@ -1,5 +1,4 @@
import { Component } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { Hero, import { Hero,
HeroService } from './hero.service'; HeroService } from './hero.service';
@ -12,9 +11,11 @@ import { Hero,
</div> </div>
` `
}) })
export class HeroListComponent { export class HeroListComponent implements OnInit {
heroes: Observable<Hero[]>; heroes: Promise<Hero[]>;
constructor(private heroService: HeroService) { constructor(private heroService: HeroService) { }
ngOnInit() {
this.heroes = this.heroService.getHeroes(); this.heroes = this.heroService.getHeroes();
} }
} }

View File

@ -5,9 +5,8 @@ import { FormsModule } from '@angular/forms';
import { HeroComponent } from './hero.component.3'; import { HeroComponent } from './hero.component.3';
import { HeroDetailComponent } from './hero-detail.component'; import { HeroDetailComponent } from './hero-detail.component';
import { HeroListComponent } from './hero-list.component'; import { HeroListComponent } from './hero-list.component';
import { HeroRoutingModule } from './hero-routing.module.3';
import { HighlightDirective } from './highlight.directive'; import { HighlightDirective } from './highlight.directive';
import { HeroRoutingModule } from './hero-routing.module.3';
// #docregion class // #docregion class
@NgModule({ @NgModule({

View File

@ -1,8 +1,4 @@
import { Injectable, OnDestroy } from '@angular/core'; import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { of } from 'rxjs/observable/of';
import { delay } from 'rxjs/operators';
export class Hero { export class Hero {
constructor(public id: number, public name: string) { } constructor(public id: number, public name: string) { }
@ -19,19 +15,18 @@ const HEROES: Hero[] = [
const FETCH_LATENCY = 500; const FETCH_LATENCY = 500;
/** Simulate a data service that retrieves heroes from a server */
@Injectable() @Injectable()
export class HeroService implements OnDestroy { export class HeroService {
constructor() { console.log('HeroService instance created.'); } getHeroes() {
ngOnDestroy() { console.log('HeroService instance destroyed.'); } return new Promise<Hero[]>(resolve => {
setTimeout(() => { resolve(HEROES); }, FETCH_LATENCY);
getHeroes(): Observable<Hero[]> { });
return of(HEROES).pipe(delay(FETCH_LATENCY));
} }
getHero(id: number | string): Observable<Hero> { getHero(id: number | string) {
return of(HEROES.find(hero => hero.id === +id)) return this.getHeroes()
.pipe(delay(FETCH_LATENCY)); .then(heroes => heroes.find(hero => hero.id === +id));
} }
} }

View File

@ -1,15 +1,12 @@
// #docplaster
// #docregion // #docregion
import { Directive, ElementRef } from '@angular/core'; import { Directive, ElementRef } from '@angular/core';
// Highlight the host element in gold
@Directive({ selector: '[highlight]' }) @Directive({ selector: '[highlight]' })
/** Highlight the attached element in gold */
export class HighlightDirective { export class HighlightDirective {
constructor(el: ElementRef) { constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'gold'; el.nativeElement.style.backgroundColor = 'gold';
// #enddocregion console.log(
console.log(`* AppRoot highlight called for ${el.nativeElement.tagName}`); `* AppRoot highlight called for ${el.nativeElement.tagName}`);
// #docregion
} }
} }
// #enddocregion

View File

@ -1,8 +1,9 @@
/* tslint:disable */
// Exact copy of contact/highlight.directive except for color and message // Exact copy of contact/highlight.directive except for color and message
import { Directive, ElementRef } from '@angular/core'; import { Directive, ElementRef } from '@angular/core';
@Directive({ selector: '[highlight], input' }) @Directive({ selector: '[highlight], input' })
// Highlight the host element or any InputElement in gray /** Highlight the attached element or an InputElement in gray */
export class HighlightDirective { export class HighlightDirective {
constructor(el: ElementRef) { constructor(el: ElementRef) {
el.nativeElement.style.backgroundColor = 'lightgray'; el.nativeElement.style.backgroundColor = 'lightgray';

View File

@ -1,6 +1,6 @@
<!-- #docregion --> <!-- #docregion -->
<!-- #docregion v1 --> <!-- #docregion v1 -->
<h1 highlight>{{title}}</h1> <h1 highlight>{{title}} {{subtitle}}</h1>
<!-- #enddocregion v1 --> <!-- #enddocregion v1 -->
<!-- #docregion ngIf --> <!-- #docregion ngIf -->
<p *ngIf="user"> <p *ngIf="user">

View File

@ -1,17 +1,18 @@
// #docplaster // #docplaster
// #docregion // #docregion
// #docregion v1 // #docregion v1
import { Component } from '@angular/core'; import { Component, Input } from '@angular/core';
// #enddocregion v1 // #enddocregion v1
import { UserService } from './user.service'; import { UserService } from './user.service';
// #docregion v1 // #docregion v1
@Component({ @Component({
selector: 'app-title', selector: 'app-title',
templateUrl: './title.component.html' templateUrl: './title.component.html',
}) })
export class TitleComponent { export class TitleComponent {
title = 'Angular Modules'; @Input() subtitle = '';
title = 'NgModules';
// #enddocregion v1 // #enddocregion v1
user = ''; user = '';

View File

@ -1,3 +0,0 @@
[1030/162525.401:ERROR:process_reader_win.cc(123)] NtOpenThread: {Acceso denegado} Un proceso ha solicitado acceso a un objeto, pero no se le han concedido esos derechos de acceso. (0xc0000022)
[1030/162525.402:ERROR:exception_snapshot_win.cc(87)] thread ID 26896 not found in process
[1030/162525.402:WARNING:crash_report_exception_handler.cc(62)] ProcessSnapshotWin::Initialize failed

View File

@ -1,4 +0,0 @@
<div class="container">
<h1>Reactive Forms</h1>
<app-hero-detail></app-hero-detail>
</div>

View File

@ -0,0 +1,12 @@
// #docregion
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
template: `
<div class="container">
<h1>Reactive Forms</h1>
<app-hero-detail></app-hero-detail>
</div>`
})
export class AppComponent { }

View File

@ -1,4 +0,0 @@
<div class="container">
<h1>Reactive Forms</h1>
<app-hero-list></app-hero-list>
</div>

View File

@ -3,7 +3,10 @@ import { Component } from '@angular/core';
@Component({ @Component({
selector: 'app-root', selector: 'app-root',
templateUrl: './app.component.html', template: `
styleUrls: ['./app.component.css'] <div class="container">
<h1>Reactive Forms</h1>
<app-hero-list></app-hero-list>
</div>`
}) })
export class AppComponent { } export class AppComponent { }

View File

@ -6,9 +6,9 @@ import { BrowserModule } from '@angular/platform-browser';
import { ReactiveFormsModule } from '@angular/forms'; // <-- #1 import module import { ReactiveFormsModule } from '@angular/forms'; // <-- #1 import module
import { AppComponent } from './app.component'; import { AppComponent } from './app.component';
import { HeroDetailComponent } from './hero-detail/hero-detail.component'; // <-- #1 import component import { HeroDetailComponent } from './hero-detail.component'; // <-- #1 import component
// #enddocregion v1 // #enddocregion v1
import { HeroListComponent } from './hero-list/hero-list.component'; import { HeroListComponent } from './hero-list.component';
import { HeroService } from './hero.service'; // <-- #1 import service import { HeroService } from './hero.service'; // <-- #1 import service
// #docregion v1 // #docregion v1
@ -20,7 +20,7 @@ import { HeroService } from './hero.service'; // <-- #1 import service
], ],
declarations: [ declarations: [
AppComponent, AppComponent,
HeroDetailComponent, HeroDetailComponent, // <-- #3 declare app component
// #enddocregion v1 // #enddocregion v1
HeroListComponent HeroListComponent
// #docregion v1 // #docregion v1

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