Compare commits

...

428 Commits

Author SHA1 Message Date
184b83911c release: cut the v9.0.0-rc.6 release 2019-12-11 10:52:32 -08:00
d7c459a81a fix(bazel): improve performance of tsHost.writeFile() (#34331)
Removing from an array incurs O(n^2) cost, and could be mitigated with the use of a Set instead.

PR Close #34331
2019-12-11 09:51:15 -08:00
b4d49eafc1 test(ivy): class_binding benchmark fixes (#34242)
This commit fixes a couple issues that prevent `class_binding` benchmark from running: moving constants requires by the `benchmark` function before function declaration and referencing correct consts in template instructions.

PR Close #34242
2019-12-11 09:50:24 -08:00
7fe9145f1f docs: fix headers in "Getting Started" code-snippets (#34321)
The headers of two of the code-snippets in the [Input section](https://angular.io/start#input)
of the "Getting Started" guide incorrectly referenced an non-existent
file path (`src/app/product-list/product-alerts.component.ts`).

This commit fixes the headers to show the correct file path
(`src/app/product-alerts/product-alerts.component.ts`).

Fixes #34320

PR Close #34321
2019-12-11 09:49:50 -08:00
ad82ed891e refactor(ivy): include generic type for ModuleWithProviders in .d.ts files (#34235) (#34340)
The `ModuleWithProviders` type has an optional type parameter that
should be specified to indicate what NgModule class will be provided.
This enables the Ivy compiler to statically determine the NgModule type
from the declaration files. This type parameter will become required in
the future, however to aid in the migration the compiler will detect
code patterns where using `ModuleWithProviders` as return type is
appropriate, in which case it transforms the emitted .d.ts files to
include the generic type argument.

This should reduce the number of occurrences where `ModuleWithProviders`
is referenced without its generic type argument.

Resolves FW-389

PR Close #34235

PR Close #34340
2019-12-11 08:48:11 -08:00
bcebc5f4f3 refactor(ivy): abstract .d.ts file transformations (#34235) (#34340)
This commit refactors the way the compiler transforms .d.ts files during
ngtsc builds. Previously the `IvyCompilation` kept track of a
`DtsFileTransformer` for each input file. Now, any number of
`DtsTransform` operations that need to be applied to a .d.ts file are
collected in the `DtsTransformRegistry`. These are then ran using a
single `DtsTransformer` so that multiple transforms can be applied
efficiently.

PR Close #34235

PR Close #34340
2019-12-11 08:48:11 -08:00
676aca108f fix(ivy): throw a better error when DI can't inject a ctor param (#33739) (#34340)
Occasionally a factory function needs to be generated for an "invalid"
constructor (one with parameters types which aren't injectable). Typically
this happens in JIT mode where understanding of parameters cannot be done in
the same "up-front" way that the AOT compiler can.

This commit changes the JIT compiler to generate a new `invalidFactoryDep`
call for each invalid parameter. This instruction will error at runtime if
called, indicating both the index of the invalid parameter as well as (via
the stack trace) the factory function which was generated for the type being
constructed.

Fixes #33637

PR Close #33739

PR Close #34340
2019-12-11 08:48:10 -08:00
4b95ba43a5 refactor(ivy): remove tsickle workaround in chainable instruction (#34019) (#34340)
Previously if a type was returning itself it would cause an infinite loop in tsickle. We worked around it with a type that alises to `any`. Now that the issue has been resolved in tsickle, we can clean up the workaround.

PR Close #34019

PR Close #34340
2019-12-11 08:48:10 -08:00
7ed984b30c fix(ivy): add flag to skip non-exported classes (#33921) (#34340)
In ViewEngine we were only generating code for exported classes, however with Ivy we do it no matter whether the class has been exported or not. These changes add an extra flag that allows consumers to opt into the ViewEngine behavior. The flag works by treating non-exported classes as if they're set to `jit: true`.

Fixes #33724.

PR Close #33921

PR Close #34340
2019-12-11 08:48:10 -08:00
c66fd060c0 perf(ivy): chain styling instructions (#33837) (#34340)
Adds support for chaining of `styleProp`, `classProp` and `stylePropInterpolateX` instructions whenever possible which should help generate less code. Note that one complication here is for `stylePropInterpolateX` instructions where we have to break into multiple chains if there are other styling instructions inbetween the interpolations which helps maintain the execution order.

PR Close #33837

PR Close #34340
2019-12-11 08:48:10 -08:00
d3ec306d98 perf(ivy): chain listener instructions (#33720) (#34340)
Chains multiple listener instructions on a particular element into a single call which results in less generated code. Also handles listeners on templates, host listeners and synthetic host listeners.

PR Close #33720

PR Close #34340
2019-12-11 08:48:10 -08:00
bbb9412a17 fix(compiler-cli): allow declaration-only template type check members (#34296)
The metadata collector for View Engine compilations emits error symbols
for static class members that have not been initialized, which prevents
a library from building successfully when `strictMetadataEmit` is
enabled, which is recommended for libraries to avoid issues in library
consumers. This is troublesome for libraries that are adopting static
members for the Ivy template type checker: these members don't need a
value assignment as only their type is of importance, however this
causes metadata errors. As such, a library used to be required to
initialize the special static members to workaround this error,
undesirably introducing a code-size overhead in terms of emitted
JavaScript code.

This commit modifies the collector logic to specifically ignore
the special static members for Ivy's template type checker, preventing
any errors from being recorded during the metadata collection.

PR Close #34296
2019-12-10 16:31:25 -08:00
edfaab62bc fix(ivy): inherit static coercion members from base classes (#34296)
For Ivy's template type checker it is possible to let a directive
specify static members to allow a wider type for some input:

```typescript
export class MatSelect {
  @Input() disabled: boolean;

  static ngAcceptInputType_disabled: boolean | string;
}
```

This allows a binding to the `MatSelect.disabled` input to be of type
boolean or string, whereas the `disabled` property itself is only of
type boolean.

Up until now, any static `ngAcceptInputType_*` property was not
inherited for subclasses of a directive class. This is cumbersome, as
the directive's inputs are inherited, so any acceptance member should as
well. To resolve this limitation, this commit extends the flattening of
directive metadata to include the acceptance members.

Fixes #33830
Resolves FW-1759

PR Close #34296
2019-12-10 16:31:24 -08:00
059206b7b7 docs: add change detection to glossary (#34316)
PR Close #34316
2019-12-10 16:30:36 -08:00
74bbe3e413 refactor(ivy): avoid type coercion in saveNameToExportMap function (#34335)
TypeScript 3.7 flags `if` conditions that implicitly coerce a function/method definition. While checking for the `template` presence on a def (actually checking whether we work with Component) in `saveNameToExportMap`, the `if` condition had implicit type coercion. This commit updates the condition to use the `isComponentDef` function (that checks `def.template` against `null` internally) to avoid compilation errors with TypeScript 3.7.

PR Close #34335
2019-12-10 14:06:26 -08:00
46f9201e6f refactor(ivy): pull property read into a constant (#34290)
PR Close #34290
2019-12-10 10:33:20 -08:00
7b59159443 refactor(ivy): prevent -0 from being generated (#34290)
PR Close #34290
2019-12-10 10:33:20 -08:00
b0d5784b63 fix(ivy): handle SafeStyles in [style.prop] correctly (#34286)
Prior to this commit, values wrapped into SafeStyle were not handled correctly in [style.prop] bindings in case style sanitizer is present (when template contains some style props that require sanitization). Style sanitizer was not unwrapping values in case a given prop doesn't require sanitization.As a result, wrapped values were used as final styling values (see https://github.com/angular/angular/blob/master/packages/core/src/render3/styling/bindings.ts#L620). This commit updates the logic to unwrap safe values in sanitizer in case no sanitization is required.

PR Close #34286
2019-12-10 10:32:28 -08:00
7c2bb37e4e refactor(docs-infra): give more descriptive variable name (#34284)
Discussion:
https://github.com/angular/angular/pull/34213#discussion_r353249119

PR Close #34284
2019-12-10 09:18:36 -08:00
8c53de2cce docs: Fix links to Webpack docs (#34326)
The previous link, https://webpack.js.org/configuration/dev-server/#devserver-proxy, doesn't go directly to the proxy section.
PR Close #34326
2019-12-10 09:18:18 -08:00
3b3610164b fix(docs-infra): fix styling of embedded Table-of-Contents (#34312)
This commit fixes the following issues:
- Align text content with caret icon in embedded ToC header.
- Fix display of expand/collapse button at the bottom of embeded ToC.

These were accidentally broken in #32124, while fixing another
ToC-related issue. Some CSS rules in `_toc.scss` (e.g. those for
`.mat-icon` and `ul.toc-list`) were correctly moved out of the
`.toc-inner > button` block, but others (e.g. `&.toc-heading` and
`&.toc-more-items`) should not have been moved outside the
`.toc-inner > button` block.

_Before:_
![toc-styles before](https://user-images.githubusercontent.com/8604205/70441952-00df2380-1a9e-11ea-8fc7-d141cc8c9045.png)

_After:_
![toc-styles after](https://user-images.githubusercontent.com/8604205/70441953-0177ba00-1a9e-11ea-8af8-d497977009ae.png)

Closes #34300

PR Close #34312
2019-12-10 09:17:34 -08:00
0d07d8379b docs: fix broken links (#34311)
PR Close #34311
2019-12-10 09:17:13 -08:00
24d1f9e87c fix(ngcc): fix undecorated child migration when exportAs is present (#34014)
The undecorated child migration creates a synthetic decorator, which
contained `"exportAs": ["exportName"]` as obtained from the metadata of
the parent class. This is a problem, as `exportAs` needs to specified
as a comma-separated string instead of an array. This commit fixes the
bug by transforming the array of export names back to a comma-separated
string.

PR Close #34014
2019-12-09 16:13:10 -08:00
3cd43c1173 fix(ngcc): log Angular error codes correctly (#34014)
Replaces the "TS-99" sequence with just "NG", so that error codes are
logged correctly.

PR Close #34014
2019-12-09 16:13:10 -08:00
599dcd0d85 fix(ngcc): report diagnostics from migrations (#34014)
When ngcc is analyzing synthetically inserted decorators from a
migration, it is typically not expected that any diagnostics are
produced. In the situation where a diagnostic is produced, however, the
diagnostic would not be reported at all. This commit ensures that
diagnostics in migrations are reported.

PR Close #34014
2019-12-09 16:13:10 -08:00
60051ebb59 fix(compiler): switch to modern diagnostic formatting (#34234)
The compiler exports a `formatDiagnostics` function which consumers can use
to print both ts and ng diagnostics. However, this function was previously
using the "old" style TypeScript diagnostics, as opposed to the modern
diagnostic printer which uses terminal colors and prints additional context
information.

This commit updates `formatDiagnostics` to use the modern formatter, plus to
update Ivy's negative error codes to Angular 'NG' errors.

The Angular CLI needs a little more work to use this function for printing
TS diagnostics, but this commit alone should fix Bazel builds as ngc-wrapped
goes through `formatDiagnostics`.

PR Close #34234
2019-12-09 11:37:49 -08:00
e3d829fc66 docs: Adds NgModule into back-ticks (#34302)
PR Close #34302
2019-12-09 11:36:36 -08:00
1347064342 docs(core): add new example for HostListener (#34228)
PR Close #34228
2019-12-09 10:38:02 -08:00
d0160e71f9 refactor(ivy): minor cleanup in the listener instruction (#34255)
PR Close #34255
2019-12-09 10:36:16 -08:00
eb8cd6cb57 docs(forms): fix a punctuation error (#34278)
PR Close #34278
2019-12-09 10:35:04 -08:00
10a33efc3e fix(ivy): align TestBed.overrideProvider with what happens with providers in TestBed providers array (#33769)
In Ivy, if you do:
`TestBed.configureTestingModule({providers: [{provide: Service}]});`
the injector will attempt to inject Service as if it was simply listed
in the providers array like `{providers: [Service]}`
This fixes an inconsistency when similarly providing an override with no
`useValue` or `useFactory`.

PR Close #33769
2019-12-06 13:06:23 -08:00
26dba2180f fix(compiler): ensure localized strings are ES5 compatible for JIT mode (#34265)
Previously the JIT evaluated code for ivy localized strings included
backtick tagged template strings, which are not compatible with ES5
in legacy browsers such as IE 11.

Now the generated code is ES5 compatible.

Fixes #34246

PR Close #34265
2019-12-06 13:03:47 -08:00
24bbcafe78 fix(ivy): do not invoke change detection for destroyed views (#34241)
Prior to this commit, calling change detection for destroyed views resulted in errors being thrown in some cases. This commit adds a check to make sure change detection is invoked for non-destroyed views only.

PR Close #34241
2019-12-06 13:03:09 -08:00
af36bc6ba3 fix(ivy): properly parenthesize ternary expressions when emitted (#34221)
Previously, ternary expressions were emitted as:

condExpr ? trueCase : falseCase

However, this causes problems when ternary operations are nested. In
particular, a template expression of the form:

a?.b ? c : d

would have compiled to:

a == null ? null : a.b ? c : d

The ternary operator is right-associative, so that expression is interpreted
as:

a == null ? null : (a.b ? c : d)

when in reality left-associativity is desired in this particular instance:

(a == null ? null : a.b) ? c : d

This commit adds a check in the expression translator to detect such
left-associative usages of ternaries and to enforce such associativity with
parentheses when necessary.

A test is also added for the template type-checking expression translator,
to ensure it correctly produces right-associative expressions for ternaries
in the user's template.

Fixes #34087

PR Close #34221
2019-12-06 13:01:48 -08:00
6e944acaae build: remove compile build variable (#34280)
Remove the remaining check for compile build variable in the ng_module
rule.  Now that components is no longer relying on this build variable
we can safely remove it from our repository.

We will leave the remaining check for if the compile build variable is
used within our own repo, with plans to remove it in a couple months.
It is being kept in place to ensure that uncommitted local scripts for
our own development that we have locally, kill error as expected if
they still reference the compile build variable.

PR Close #34280
2019-12-06 11:04:22 -08:00
8288f8f0a4 ci: update sha of components repo for components unit test integrations (#34280)
Before updating to remove the compile build variable, we must update
the components unit test integrations to a sha  in the components
repo which no longer relies on the compile build variable.

PR Close #34280
2019-12-06 11:04:21 -08:00
5dcc7e4524 feat(docs-infra): add the ability to expose globals (#34237)
Adds the ability to expose global symbols in the API docs via the `@globalApi` tag. Also supports optionally setting a namespace which will be added to the name automatically (e.g. `foo` will be renamed to `ng.foo`). Relevant APIs should also be exported through the `global.ts` file which will show up under `core/global`.

PR Close #34237
2019-12-06 10:58:10 -08:00
7dfd327099 fix(language-service): Simplify resolution logic in banner (#34262)
Due to a bug in the existing banner, `typescript` module was require-d
instead of reusing the module passed in from tsserver.
This bug is caused by some source files in language-service that imports
`typescript` instead of `typescript/lib/tsserverlibrary`.
This is not an unsupported use case, it's just that when typescript is
resolved in the banner we have to be very careful about which modules to
"require".
The convoluted logic in the banner makes it very hard to detect
anomalies. This commit cleans it up and removes a lot of unneeded code.

This commit also removes `ts` import in typescript_host.ts and use `tss`
instead to make it less confusing.

PR Close #34262
2019-12-06 10:27:31 -08:00
6c70ba7376 docs: edit copy of getting started step 3 (#32820)
PR Close #32820
2019-12-06 10:27:01 -08:00
9a43749854 build(docs-infra): upgrade cli command docs sources to cbe25bfbf (#34268)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](128515a6a...cbe25bfbf):

**Modified**
- help/deploy.json

##

PR Close #34268
2019-12-06 10:26:07 -08:00
0e911f87b0 fix(language-service): Remove getExternalFiles() (#34260)
This commit removes the `getExternalFiles()` from the tsserver plugin.
This API is no longer needed now that we do not intend to support
external templates under the plugin mode.
Instead, the external files are added to the project only when they are
opened by the user.
For complete discussion, see https://github.com/angular/vscode-ng-language-service/issues/473

PR closes https://github.com/angular/vscode-ng-language-service/issues/469
PR closes https://github.com/angular/vscode-ng-language-service/issues/473

PR Close #34260
2019-12-05 13:13:21 -08:00
99745009a8 refactor(language-service): refactor the method TypeWrapper.name and PipeSymbol.selectSignature (#34177)
PR Close #34177
2019-12-05 13:12:45 -08:00
46393379e1 fix(language-service): apply suggestion (#34177)
PR Close #34177
2019-12-05 13:12:45 -08:00
b4680a64c5 fix(language-service): return the js primitive type name (#34177)
PR Close #34177
2019-12-05 13:12:45 -08:00
72a5a8cab7 fix(language-service): bug of accessing a string index signature using dot notation (#34177)
PR Close #34177
2019-12-05 13:12:45 -08:00
5f0703de16 perf: rename index to index_aot (#34258)
The renaming is needed so that js-web-frameworks benchmark test works
inside google.

PR Close #34258
2019-12-05 13:10:49 -08:00
178016b69e build: Enable ivy in google3 if ng_module attr is True (#34238)
This commit creates a way for `ng_module` rule to compile with Ivy based
on the `ivy` attribute. This enables google3 targets to pick the
compiler without using `define` flags.

PR Close #34238
2019-12-05 13:09:44 -08:00
ab85c39589 build: set upper version limit for yarn to <2 (#34236)
Rather than bumping up the allowed version of yarn on each release
we should instead just allow for anything within the major version
1 range.

PR Close #34236
2019-12-05 13:07:42 -08:00
50e115e609 fix(docs-infra): make header full-width and panels full-width on mobile screens (#34188)
On events page the header was not able to take full width when body exceeds viewport width of the screen So made the below body go overflow-x auto and resources page was taking 80% of the width which is okay on desktop but on mobile it should take 100% width put a media quer for it.

Fixes #34163

PR Close #34188
2019-12-05 13:06:37 -08:00
5aeb16f422 docs: fix migrations formatting (#33267)
PR Close #33267
2019-12-05 13:06:02 -08:00
81c8b83a8f docs: add David Shevitz to about page (#34222)
PR Close #34222
2019-12-05 11:20:00 -08:00
b4600cadbf ci: update saucelabs to use angular-framework account (#34233)
Currently all saucelabs usage in our repos is done using the same
account angular-ci.  By migrating to use individual accounts
for each repo, we can better track the usage for each repo as well
as providing concurrency limiting on a per repo basis.

Additionally, we no longer use two separate accounts based on being
on master or a PR branch, so this logic can be removed.

PR Close #34233
2019-12-05 10:21:43 -08:00
83ccaa6cec build: update to rules_nodejs 0.42.2 (#34243)
This release brings two bug fixes we're waiting on:
1) fix(builtin): additional_root_paths in pkg_web should also include paths in genfiles and bin dirs (https://github.com/bazelbuild/rules_nodejs/pull/1402), which is a pre-req for https://github.com/angular/angular/pull/34112
2) fix(typescript): fix for cross platform ts_devserver issue #1409 (https://github.com/bazelbuild/rules_nodejs/pull/1413) which resolves ts_devserver launcher template is platform specific #1409 (https://github.com/bazelbuild/rules_nodejs/issues/1409) --- this fixes an OSX developer workflow with --config=remote

This does not upgrade integration/bazel or integation/schematics. That will be done in another PR.

PR Close #34243
2019-12-05 10:20:32 -08:00
b5f2824913 build(docs-infra): upgrade cli command docs sources to 128515a6a (#34251)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](1dcc727ab...128515a6a):

**Modified**
- help/test.json

##

PR Close #34251
2019-12-05 10:14:25 -08:00
f87f011e7c docs: add documentation for server and Ivy without bundleDependencies (#34225)
PR Close #34225
2019-12-05 10:13:58 -08:00
4bf1bdc69a test(ngcc): update ngcc integration test dependencies (#34212)
This commit updates `@angular/material` and `@angular/cdk` to the
latest release candidate. Doing so exposed a bug in ngcc, which is fixed
by the preceding commit. Also the layout of these libraries changed, so
the checks in the integration test need a bit of tweaking.

PR Close #34212
2019-12-05 10:13:03 -08:00
69dd516666 fix(ngcc): ensure that bundle rootDir is the package path (#34212)
Previously the `rootDir` was set to the entry-point path but
this is incorrect if the source files are stored in a directory outside
the entry-point path. This is the case in the latest versions of the
Angular CDK.

Instead the `rootDir` should be the containing package path, which is
guaranteed to include all the source for the entry-point.

---

A symptom of this is an error when ngcc is trying to process the source of
an entry-point format after the entry-point's typings have already been
processed by a previous processing run.

During processing the `_toR3Reference()` function gets called which in turn
makes a call to `ReflectionHost.getDtsDeclaration()`. If the typings files
are also being processed this returns the node from the dts typings files.

But if we have already processed the typings files and are now processing
only an entry-point format without typings, the call to
`ReflectionHost.getDtsDeclaration()` returns `null`.

When this value is `null`, a JS `valueRef` is passed through as the DTS
`typeRef` to the `ReferenceEmitter`. In this case, the `ReferenceEmitter`
fails during `emit()` because no `ReferenceEmitStrategy` is able to provide
an emission:

1) The `LocalIdentifierStrategy` is not able help because in this case
`ImportMode` is `ForceNewImport`.
2) The `LogicalProjectStrategy` cannot find the JS file below the `rootDir`.

The second strategy failure is fixed by this PR.

Fixes https://github.com/angular/ngcc-validation/issues/495

PR Close #34212
2019-12-05 10:13:03 -08:00
aa2b5789a2 fix(docs-infra): add deprecated-api-item class to remaining deprecated items (#34192)
Fixes #31455

PR Close #34192
2019-12-05 10:12:11 -08:00
a97d2c06c5 docs: update Angular books list (#34062)
PR Close #34062
2019-12-05 10:11:26 -08:00
a616c429ab docs: edit copy of getting started step 2 (#32776)
PR Close #32776
2019-12-05 10:10:40 -08:00
1183075d16 Revert "fix(common): update closure locales to include directionality data (#34240)"
This reverts commit a02bde74d2.
2019-12-04 15:07:33 -08:00
a02bde74d2 fix(common): update closure locales to include directionality data (#34240)
When directionality data was added to @angular/common locales, only
the externally used locales were updated.  We need to additionally
update the closure locales which are synced into google3.

PR Close #34240
2019-12-04 15:04:18 -08:00
848018f5d3 release: cut the v9.0.0-rc.5 release 2019-12-04 10:48:03 -08:00
95557318bc test(ivy): update ngI18nClosureMode flag usage in tests (#34224)
Commit that updated i18n message ids rendering (e524322c43) also introduced a couple tests that relied on a previous version of `ngI18nClosureMode` flag format. The `ngI18nClosureMode` usage format was changed in the followup commit (c4ce24647b) and triggered a problem with the mentioned tests. This commit updates the tests to a new `ngI18nClosureMode` flag usage format.

PR Close #34224
2019-12-03 23:03:28 -08:00
f1737ff578 build: add karma-sauce-launcher dependency for karma_web_test macro (#34220)
Currently our bazel saucelabs tests silently fail as it does not have
karma-sauce-launcher available from npm.  By providing it as expected
we will properly run the bazel saucelabs tests once more

PR Close #34220
2019-12-03 16:19:06 -08:00
4d025562c4 fix(compiler-cli): ensure that ngI18nClosureMode is guarded in generated code (#34211)
If the `ngI18nClosureMode` global check actually makes it
through to the runtime, then checks for its existence should
be guarded to prevent `Reference undefined` errors in strict
mode.

(Normally, it is stripped out by dead code elimination during
build optimization.)

This comment ensures that generated template code guards
this global check.

PR Close #34211
2019-12-03 16:18:13 -08:00
25462614db fix(core): ensure that ngI18nClosureMode is guarded (#34211)
If the `ngI18nClosureMode` global check actually makes it
through to the runtime, then checks for its existence should
be guarded to prevent `Reference undefined` errors in strict
mode.

(Normally, it is stripped out by dead code elimination during
build optimization.)

PR Close #34211
2019-12-03 16:18:13 -08:00
c92c9f7e21 refactor(common): add defaults to new generic parameters (#34206)
This is a follow-up to #33997 where some new generic parameters were added without defaults which is technically a breaking change. These changes add the defaults.

PR Close #34206
2019-12-03 16:16:31 -08:00
668692598b refactor(ivy): check metadata presence before compiling Type in R3TestBed (#34204)
Prior to this commit, there was no check in R3TestBed to verify that metadata is resolved using a given Type. That leads to some cryptic error messages (when TestBed tries to compile a Type without having metadata) in case TestBed override functions receive unexpected Types (for example a Directive is used in `TestBed.overrideComponent` call). This commit adds the necessary checks to verify metadata presence before TestBed tries to (re)compile a Type.

PR Close #34204
2019-12-03 16:13:55 -08:00
41ea3c214a fix(ivy): correctly support ngProjectAs on templates (#34200)
Prior to this commit, if a template (for example, generated using structural directive such as *ngIf) contains `ngProjectAs` attribute, it was not included into attributes array in generated code and as a result, these templates were not matched at runtime during content projection. This commit adds the logic to append `ngProjectAs` values into corresponding element's attribute arrays, so content projection works as expected.

PR Close #34200
2019-12-03 16:12:56 -08:00
eae541b6e2 fix(ivy): support ICUs with pipes (#34198)
Prior to this commit, i18n runtime code failed with the exception saying that no provider was found for ChangeDetectorRef for a pipe used in ICU. The problem happened because the underlying `createViewRef` function was not taking into account IcuContainer as a valid TNodeType. This commit updates the `createViewRef` function to return corresponding ViewRef for TNodeType.IcuContainer.

PR Close #34198
2019-12-03 16:12:20 -08:00
b712065726 docs: add kwinten pisman to GDE resources (#34184)
PR Close #34184
2019-12-03 16:11:41 -08:00
00f7372554 perf(ivy): avoid duplicate state lookup and default function parameters (#34183)
Includes a few minor performance improvements:
* In the `nextContext` instruction we assign a new LView to the `LFrame.contextLView` and then we immediately look it up to get its context. We don't need to do that since we know the view that was assigned already.
* Removes the default value for the `level` parameter of `nextContextImpl` because it generates more code in es5 and is internal-only.
* Removes the default parameter from `setActiveHostElement` since it generates extra code and it's an internal function.
* Makes a check in `setElementExitFn` more strict since we're guaranteed for the value to match the type.

PR Close #34183
2019-12-03 16:10:43 -08:00
5a98410a7d test(ivy): ViewContainerRef.move where the old and new indexes are the same (#34156)
PR Close #34156
2019-12-03 16:08:49 -08:00
65cd811de8 fix(ivy): allow insertion of views attached to a different container (#34156)
Fixes #34152

PR Close #34156
2019-12-03 16:08:49 -08:00
0044c6621e fix(ivy): consistenly return -1 from ViewContainerRef.indexOf for non-inserted view (#34156)
PR Close #34156
2019-12-03 16:08:48 -08:00
91f4b81f79 docs(core): update render factory description (#34137)
PR Close #34137
2019-12-03 16:08:00 -08:00
383be62afa docs(compiler): fix typos and spelling (#34008)
PR Close #34008
2019-12-03 16:05:33 -08:00
6123261ad6 docs: remove information about which version of Firefox started supporting custom elements (#34007)
PR Close #34007
2019-12-03 16:04:54 -08:00
d2538cab5a fix(language-service): Make missing module suggestion instead of error (#34115) (#34193)
If a Component or Directive is not part of any NgModule, the language
service currently produces an error message. This should not be an
error. Instead, it should be a suggestion.

This PR removes `ng.DiagnosticKind`, and instead reuses
`ts.DiagnosticCategory`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/458

PR Close #34115

(cherry picked from commit 7eccbcd30d)

PR Close #34193
2019-12-03 10:47:19 -08:00
dd6da21068 docs(service-worker): fix paths for ngsw-config command to match latest CLI (#34215)
PR Close #34215
2019-12-03 10:42:08 -08:00
d516d5253b fix(docs-infra): avoid version mismatch error when using local Angular packages (#34213)
The local Angular packages used to build `aio/` when running
`yarn setup-local`/`yarn build-local` (and related commands), are built
by bazel. Bazel, determines the version to use for these locally built
packages based on the latest tag for a commit on the current branch.
(This works as expected during the release, because the packages are
built on the correct branch with up-to-date tags.)

During local development, however, this often leads to generating older
versions than what the current `@angular/cli` version is compatible
with, if the user has not fetched the latest tags from `angular/angular`
or the branch has not been rebased recently.

Previously, the above (common) situation would result in a build error
by the CLI. (Note that this would be a false error, because in this case
the version set by bazel would not reflect the actual version of the
local packages.) The solution would be for the user to fetch the latest
tags from `angular/angular`, rebase their branch and run a bazel build
again (ensuring that it would actually build anew and not emit cached
artifacts). This was cumbersome and most people didn't even know about
it.

This commit avoids this error and the associated pain-points by
overwriting the versions of the installed local packages with fake
versions based on the ones in the lockfile, which are guaranteed to be
compatible with the currently used CLI version.

Fixes #34208

PR Close #34213
2019-12-03 10:40:14 -08:00
c89017a286 build(docs-infra): upgrade cli command docs sources to 1dcc727ab (#34209)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](062469ad6...1dcc727ab):

**Modified**
- help/test.json

##

PR Close #34209
2019-12-03 10:37:32 -08:00
65755edfa0 docs: clarify differential load doc (#34189)
PR Close #34189
2019-12-03 10:37:12 -08:00
4836fe08b5 fix(ivy): incorrectly validating html foreign objects inside svg (#34178)
Fixes ngtsc incorrectly logging an unknown element diagnostic for HTML elements that are inside an SVG `foreignObject` with the `xhtml` namespace.

Fixes #34171.

PR Close #34178
2019-12-03 10:29:46 -08:00
1bab8c2757 fix: implement Symbol.specics of Promise (#34162)
Close #34105, #33989

PR Close #34162
2019-12-03 10:29:05 -08:00
f4d714ca0b fix(ivy): i18n - trim whitespace when parsing metadata (#34154)
It is possible for HTML formatters to add whitespace
around the content of `i18n` attribute values. This can
make the meaning and custom ids brittle to simple
whitespace formatting.

This commit ensures that the metadata string extracted
from HTML `i18n` attributes is trimmed before being parsed
into meaning, description and custom id.

PR Close #34154
2019-12-03 10:26:47 -08:00
5cf5843be3 refactor(compiler): remove redundant metaFromI18nMessage() function (#34154)
PR Close #34154
2019-12-03 10:26:42 -08:00
64317c680d fix(compiler): i18n - trim whitespace from i18n custom ids (#34154)
Fixes #34147

PR Close #34154
2019-12-03 10:21:02 -08:00
93ac362848 fix(ngcc): render legacy i18n message ids by default (#34135)
By ensuring that legacy i18n message ids are rendered into the templates
of components for packages processed by ngcc, we ensure that these packages
can be used in an application that may provide translations in a legacy
format.

Fixes #34056

PR Close #34135
2019-12-03 10:15:54 -08:00
62d384dbbd refactor(ngcc): store whether to render legacy i18n message ids in the bundle (#34135)
Placing this configuration in to the bundle avoids having to pass the
value around through lots of function calls, but also could enable
support for different behaviour per bundle in the future.

PR Close #34135
2019-12-03 10:15:54 -08:00
33d3340bac refactor(compiler): i18n - render legacy i18n message ids (#34135)
Now that `@angular/localize` can interpret multiple legacy message ids in the
metablock of a `$localize` tagged template string, this commit adds those
ids to each i18n message extracted from component templates, but only if
the `enableI18nLegacyMessageIdFormat` is not `false`.

PR Close #34135
2019-12-03 10:15:54 -08:00
7414ece2fa refactor(ivy): i18n - store legacy message ids separately to custom ids (#34135)
This change will enable the Angular compiler to provide these legacy
message ids by default, which will solve problems with ngcc not knowing
whether to generate legacy ids or not.

PR Close #34135
2019-12-03 10:15:54 -08:00
54bfd8a0c1 test: do not copy address to the clipboard in integration test (#34135)
PR Close #34135
2019-12-03 10:15:54 -08:00
cba37734b4 test: do not store generated i18n files in git (#34135)
PR Close #34135
2019-12-03 10:15:54 -08:00
f11c6b1d42 refactor(ivy): i18n - remove hack around TS tagged literals (#34135)
When first written there was no way to specify the raw text when
programmatically creating a template tagged literal AST node.

This is now fixed in TS and so the hack is no longer needed.

PR Close #34135
2019-12-03 10:15:54 -08:00
60c350cd95 test(ngcc): tidy up helper function (#34135)
Thanks to @gkalpakl for the better regular expression approach.

PR Close #34135
2019-12-03 10:15:53 -08:00
3516213632 refactor(ivy): do not generate providedIn: null (#34116)
We should only generate the `providedIn` property in injectable
defs if it has a non-null value. `null` does not communicate
any information to the runtime that isn't communicated already
by the absence of the property.

This should give us some modest code size savings.

PR Close #34116
2019-12-03 10:14:52 -08:00
396779f6e6 docs: Ivy i18n guide updates for localize option (#34053)
PR Close #34053
2019-12-03 10:14:15 -08:00
fb22f18694 fix(language-service): Insert parentheses for method completion (#33860)
This commit leverages the `insertText` field in `ts.CompletionEntry` to
return a completion text for class methods that includes parentheses.

PR closes https://github.com/angular/vscode-ng-language-service/issues/15

PR Close #33860
2019-12-03 10:13:36 -08:00
db4789bf91 style: enforce disallowance of object constructor (#33211)
Applying the `prefer-literal` tslint rule to object enforces the style guide rule https://google.github.io/styleguide/jsguide.html#features-objects-ctor

PR Close #33211
2019-12-03 10:08:26 -08:00
354f66b904 build: disable buildifier print warning for compile=aot deprecation (#34199)
PR Close #34199
2019-12-03 10:07:21 -08:00
716fc845f5 fix(bazel): don't rely on @angular/core being as a depedency to install @angular/bazel (#34181)
With this change we fix the logic to detect if a package is installed, removing a package and add a package by using the CLI schematic helpers.

Also we save `@angular/bazel` package directly as a `devDependency` when doing `ng-add`.

Closes #34164

PR Close #34181
2019-12-02 11:40:58 -08:00
ce79cacd03 refactor(ivy): remove unnecessary fac wrapper (#34076)
For injectables, we currently generate a factory function in the
injectable def (prov) that delegates to the factory function in
the factory def (fac). It looks something like this:

```
factory: function(t) { return Svc.fac(t); }
```

The extra wrapper function is unnecessary since the args for
the factory functions are the same. This commit changes the
compiler to generate this instead:

```
factory: Svc.fac
```

Because we are generating less code for each injectable, we
should see some modest code size savings. AIO's main bundle
is about 1 KB smaller.

PR Close #34076
2019-12-02 11:35:24 -08:00
7504543962 fix(common): reflect input type in NgIf context (#33997)
Fixes the content of `NgIf` being typed to any.

Fixes #31556.

PR Close #33997
2019-12-02 11:34:26 -08:00
b640d38fd1 fix(common): reflect input type in NgForOf context (#33997)
Fixes `NgForOf` not reflecting the type of its input in the `NgForOfContext`.

PR Close #33997
2019-12-02 11:34:26 -08:00
c3c363fef9 docs: remove redundant dashes (#34172)
PR Close #34172
2019-12-02 11:26:21 -08:00
d5a48b2cc0 fix(ivy): i18n - correctly parse XLIFF placeholders (#34155)
The ViewEngine translation extractor does not convert `-` to `_` for
placeholders that represent custom elements. For example `<app-component>`
gets converted to placeholders like `START_TAG_APP-COMPONENT`.

In `$localize` placeholders are expected to be snake-case, not kebab-case.
So we must normalize them when parsing a translation file that might have
been created via the View Engine translation extractor.

The `$localize` extraction code will normalize these placeholders when
creating translation files in the first place.

Fixes #34151

PR Close #34155
2019-12-02 11:24:48 -08:00
69d27f3a08 ci: replace fixme-ivy-aot with no-ivy-aot tag for //packages/language-service/test (#34144)
This target will need to be completely updated once the language service supports Ivy.

PR Close #34144
2019-12-02 11:24:19 -08:00
daa403fb61 build: re-enable template type-checking for various targets across the repo (#34144)
Various targets have their template type-checking disabled in the past.

There is no reason for this any more.

The only target that was tricky was packages/examples/core:core_examples
which was quite broken and I had to fix it up.

Template typechecking is still disabled under blaze, see FW-1753 for more
info.

PR Close #34144
2019-12-02 11:24:19 -08:00
572e731b63 fix(bazel): reenable template type checking in ng_module (#34144)
due to an unfortunate condition in 168abc6d6f/packages/compiler-cli/src/ngtsc/program.ts (L430-L434) the typechecking has been disabled when running under bazel + ivy.

As far as I can tell the ivyTemplateTypeCheck flag is now obsolete, so removing this
code from ng_module.bzl is desirable. I'll send a separate PR to remove the flag completely.

PR Close #34144
2019-12-02 11:24:19 -08:00
0d102bb918 build: support yarn 1.19.x (#34143)
PR Close #34143
2019-12-02 11:23:49 -08:00
bbfca62b66 refactor(compiler-cli): remove bogus packages/compiler-cli/integrationtest/benchmarks/ (#34142)
nobody uses this folder for anything and the README.md is misleading.

PR Close #34142
2019-12-02 11:22:45 -08:00
08c0e6a002 build(docs-infra): upgrade cli command docs sources to 062469ad6 (#34132)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](fbfcc45a3...062469ad6):

**Modified**
- help/test.json

##

PR Close #34132
2019-12-02 11:22:19 -08:00
9995d87f96 refactor(core): update missing-injectable migration description to match guide (#34125)
Updates the description of the `missing-injectable` migration to mention the second pattern
that will be automatically handled.

PR Close #34125
2019-12-02 11:21:50 -08:00
3224d7e79c docs: update title of v9 injectable migration guide (#34125)
The missing-injectable migration has been updated to handle a breaking change that is
unrelated to missing ´@Injectable` decorators. Though, the breaking change will be handled
as part of this migration since we did not want to create another migration (with all the boilerplate etc.)

The guide has been already updated to reflect the new pattern the migration handles, but we
should also rename the title of the guide to something that also mentions the other pattern.

Not renaming the guide URL since it is referenced in past releases and it's safer to keep the old
URL. The important thing is to change the actual rendered title.

PR Close #34125
2019-12-02 11:21:50 -08:00
a5fe8501c4 docs: small typo in DI docs (#34122)
PR Close #34122
2019-12-02 11:20:40 -08:00
7a7e999fb5 fix(language-service): use host.error() instead of console.error() (#34114)
`host.error()` would log to file, and makes error messages much easier
to inspect because entries are time-stamped.

PR Close #34114
2019-12-02 11:14:09 -08:00
29de8d3ab1 fix(language-service): Do not produce diagnostics if metadata for NgModule not found (#34113)
The language service incorrectly reports an error if it fails to find
NgModule metadata for a particular Component / Directive. In many cases,
the use case is legit, particularly in test.

This commit removes such diagnostic message and cleans up the interface
for `TypeScriptHost.getTemplateAst()`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/463

PR Close #34113
2019-12-02 11:13:42 -08:00
bfeb4d2324 build: add failure message if compile build variable for angular/angular usage (#34109)
To quicken migration for our own developers away from using compile=aot
for setting ivy, we actually fail the build process if the compile
build variable is used with a message to use our config flags instead.

PR Close #34109
2019-12-02 11:13:13 -08:00
75f4757173 build: Add deprecation warning when compile=aot is used for building with Ivy (#34109)
To inform downstream users to switch to using angular_ivy_enabled as the build
variable for setting Ivy, a deprecation message is printed instructing the user
to migrate away from building with compile=*

PR Close #34109
2019-12-02 11:13:13 -08:00
12e4aa0bb6 fix(language-service): determine correct type for ngFor exported values (#34089)
Currently, variables of an unknown type in an `*ngFor` expression are
refined to have the type of the iterable binding of the `*ngFor`
expression. Unfortunately, this is a bug for variables aliasing
[values exported by
`*ngFor`](https://angular.io/api/common/NgForOf#local-variables),
including `index` and `first`, because they are also given the type of
the binding expression, but they are not of the binding type. For
example, in

```typescript
@Component({
  selector: 'test',
  template: `
    <div *ngFor="let hero of heroes; let i = index; let isFirst = first">
      {{ hero }}
    </div>
  `
})
export class TestComponent {
  heroes: Hero[];
}
```

The local variables `i` and `isFirst` are determined to have a type of
`Hero`, when actually their types are `number` and `boolean`,
respectively.

This commit fixes this bug by checking if the value of a variable in an
`*ngFor` expression is known to be an export and assigning the variable
the type of that export value. Only if the variable does not alias an
export is it typed with the binding value of the `*ngFor` expression.

Closes https://github.com/angular/vscode-ng-language-service/issues/460

PR Close #34089
2019-12-02 11:11:32 -08:00
127baa0d38 docs: add deprecated-api-item class to deprecated items (#34088)
Fixes #31455

PR Close #34088
2019-12-02 11:03:06 -08:00
075f01341d build: update to nodejs rules 0.42.1 (#34073)
* This brings in a fix to the `@npm//foo:foo_files` targets for https://github.com/angular/angular/pull/33927 so the a rules_nodejs patch can be removed.
* It also brings a protractor_web_test fix that resolves the need for a work-around in /modules/playground/e2e_test/sourcemap/BUILD.bazel.

PR Close #34073
2019-12-02 11:02:39 -08:00
2f8bbec6af test(docs-infra): ensure RxJS-related docs examples can compile without errors (#34063)
Previously, some RxJS-related examples (which are not proper Angular apps) were not
tested on CI as part of the `example-e2e` npm script. This meant that the examples
could get out-of-date or contain compile errors without as noticing.

This commit ensures that the `example-e2e` script picks up these examples and checks
that they compile successfully.

Partly addresses #28017.

PR Close #34063
2019-12-02 11:02:14 -08:00
4e766b8e0c build: remove fsevents from package.json (#34058)
we no longer need it.

PR Close #34058
2019-12-02 11:00:00 -08:00
846ff256c3 build: remove gulp-connect and cors npm dependencies (#34058)
we no longer need them.

PR Close #34058
2019-12-02 10:59:26 -08:00
325e2665ff build: remove obsolete build related tools and helper scripts (#34058)
none of these files are needed any more as they were replaced by Bazel.

PR Close #34058
2019-12-02 10:57:12 -08:00
bf16b0e4be perf: add js-web-frameworks benchmark (#34034)
PR Close #34034
2019-12-02 10:51:45 -08:00
ca88f7d2ef build: consolidate @angular-devkit/build-angular to the root package.json (#34002)
This allows us to update the version of the package in a single place for all tests.

Notable exemption of this is aio which currently doesn't depend on anything installed in the root.

PR Close #34002
2019-12-02 10:49:13 -08:00
7385e9d06d release: cut the v9.0.0-rc.4 release 2019-11-27 15:02:36 -08:00
ef8b95abae Revert "refactor: use isObservable provided by rxjs 6.1+ (#27668)"
This reverts commit 7e6350ce2e.
2019-11-27 14:08:42 -08:00
fc2db27446 docs: add ngIndia to event page (#33656)
PR Close #33656
2019-11-27 13:04:09 -08:00
b05ce85391 fix(language-service): fix error of array-index out of bounds exception (#33928)
PR Close #33928
2019-11-27 12:55:03 -08:00
7faa9bbc09 feat(language-service): completions support for tuple array (#33928)
PR Close #33928
2019-11-27 12:54:34 -08:00
7402430d06 ci: remove renovate.json because the config is incorrect (#34103)
.... and the bot is starting to spam us with lots of PRs.

PR Close #34103
2019-11-27 12:47:12 -08:00
5a8d25dfc6 fix(ngcc): do not output duplicate ɵprov properties (#34085)
Previously, the Angular AOT compiler would always add a
`ɵprov` to injectables. But in ngcc this resulted in duplicate `ɵprov`
properties since published libraries already have this property.

Now in ngtsc, trying to add a duplicate `ɵprov` property is an error,
while in ngcc the additional property is silently not added.

// FW-1750

PR Close #34085
2019-11-27 12:46:37 -08:00
955a3129f0 fix(ivy): prevent unknown element check for AOT-compiled components (#34024)
Prior to this commit, the unknown element can happen twice for AOT-compiled components: once during compilation and once again at runtime. Due to the fact that `schemas` information is not present on Component and NgModule defs after AOT compilation, the second check (at runtime) may fail, even though the same check was successful at compile time. This commit updates the code to avoid the second check for AOT-compiled components by checking whether `schemas` information is present in a logic that executes the unknown element check.

PR Close #34024
2019-11-27 12:45:33 -08:00
e059df3bad docs: update run instructions (#34090)
PR Close #34090
2019-11-27 10:39:17 -08:00
a7b298a4fd ci: disable renovate for integration tests (#34074)
the package.json in these tests points to file:dist/packages-dist which
is not materialized on renovate-bot, so the bot freaks out and fails to
update the lock files.

This means that the bot currently just opens up PRs that can't be merged.

Example: https://github.com/angular/angular/pull/34071

(In the past this worked nicely because we didn't keep the yarn.lock files
in the git repo for these projects, but that had a problem with unpined
depenedencies and undeterministic build/test runs).

For now it's better to disable the bot by removing all the package.jsons
from the config. We should revisit this in the future have the bot update
the root package.json instead.

PR Close #34074
2019-11-27 10:37:07 -08:00
00f8d6ac64 fix(ivy): i18n - ensure that escaped chars are handled in localized strings (#34065)
When creating synthesized tagged template literals, one must provide both
the "cooked" text and the "raw" (unparsed) text. Previously there were no
good APIs for creating the AST nodes with raw text for such literals.
Recently the APIs were improved to support this, and they do an extra
check to ensure that the raw text parses to be equal to the cooked text.

It turns out there is a bug in this check -
see https://github.com/microsoft/TypeScript/issues/35374.

This commit works around the bug by synthesizing a "head" node and morphing
it by changing its `kind` into the required node type.

// FW-1747

PR Close #34065
2019-11-27 10:36:36 -08:00
1b4fac192a refactor(core): update undecorated-classes-with-di migration rerun command (#33958)
With Angular CLI version 9 RC 3 we can run a single migration for a package using the name of the migration schematic.

We need to pass the schematic name as a value to the `migrate-only` option.
Ex:
```
ng update @angular/core --migrate-only migration-v9-undecorated-classes-with-di
```

See: https://github.com/angular/angular-cli/pull/16174

PR Close #33958
2019-11-27 10:36:03 -08:00
7e6350ce2e refactor: use isObservable provided by rxjs 6.1+ (#27668)
Refactor common, core, forms, router to use the isObservable method from rxjs 6.1+. Remove the isObservable method from core.

PR Close #27668
2019-11-27 10:33:45 -08:00
9e5065a778 ci: do not run ng_benchmarks on CI (#34057)
We don't collect/review the results from CI, so it's just a waste of CPU time.

It's sufficient if we are able to run these locally and manually.

PR Close #34057
2019-11-26 16:10:10 -08:00
1eddb1ae15 build: set default ts_devserver serving_path to /app_bundle.js to match g3 (#33996)
PR Close #33996
2019-11-26 16:09:33 -08:00
9255dc3468 build: update to nodejs rules 0.41.0 (#33996)
This bring is changes to the @nodejs repository required for https://github.com/angular/angular/pull/33927. See release notes for more details: https://github.com/bazelbuild/rules_nodejs/releases/tag/0.41.0.

rules_nodejs is approaching 1.0 and breaking changes for that release are being made more frequently. In this release, the ts_devserver API changed and it no longer injects html script tags into a provided index.html file. The diff on this commit is large as this breaking change affects quite a few tests.

Also note that we don’t update @angular/bazel schematics and integration/bazel as 0.41.0 is not a recommended update for angular users yet due to the breaking changes in ts_devserver & web_package (now named pkg_web). When a suitable plain npm package that is in progress is finished then it will be possible to easily replace the html injection functionality removed from ts_devserver & pkg_web.

PR Close #33996
2019-11-26 16:09:32 -08:00
c5584b2dbc ci: check versions of non-local integration project dependencies (#33968)
In order to keep integration tests on CI as determinitstic as possible,
we need to ensure that the same dependencies (including transitive ones)
are installed each time. One way to ensure that is using a lockfile
(such as `yarn.lock`) to pin the dependencies to exact versions. This
works as long as the lockfile itself is in-sync with the corresponding
`package.json`, which specifies the dependencies.

Ideally, we would run `yarn install` with the `--frozen-lockfile` option
to verify that the lockfile is in-sync with `package.json`, but we
cannot do that for integration projects, because we want to be able to
install the locally built Angular packages). Therefore, we must manually
esnure that the integration project lockfiles remain in-sync, which is
error-prone.

This commit introduces a helper script that performs some checks on each
project's (non-local) dependencies:
- Ensure that exact versions (not version ranges) are specified in
  `package.json`. This reduces the probability of installing a breaking
  version of a direct or transitive dependency, in case of an
  out-of-sync lockfile.
- Ensure that the lockfile is in-sync with `package.json` wrt these
  dependencies.

While these checks are not full-proof, they provide yet another line of
defense against indeterminism.

PR Close #33968
2019-11-26 16:08:34 -08:00
60db3505f6 build: move integration project dependencies to devDependencies (#33968)
PR Close #33968
2019-11-26 16:08:34 -08:00
6904319847 build: use exact versions for integration project dependencies (#33968)
Since we cannot run `yarn install` with the `--frozen-lockfile` option
(because we want to be able to install the locally built Angular
packages), integration project lockfiles are susceptible to getting
out-of-sync with the corresponding `package.json`. When this happens,
yarn will install the latest available version that satisfies the
version range specified in `package.json`.

This commit adds another line of defense, by specifying exact versions
for the dependencies in `package.json` files (i.e. `1.33.7` instead of
`^1.33.0`). While transitive dependencies will be unpinned, this still
ensures that the same version of direct dependencies will be installed
in case of an out-of-sync lockfile, thus reducing the probability of
random failures.

PR Close #33968
2019-11-26 16:08:33 -08:00
dda9b9ea7e build: update lockfiles for integration projects (#33968)
In the `integration_test` CircleCI job, we run `yarn install` on all
projects in the `integration/` directory. If a project has no lockfile
or if the lockfile is out-of-sync with the corresponding `package.json`
file, then the installed dependency versions are no longer pinned, which
can result in different versions being installed between different runs
of the same job (if, for example, a new version is released for a
package) and breaks hermeticity.

This could be prevented by using the `--frozen-lockfile` option with
`yarn install`, but this is not possible with the current setup, because
yarn needs to be able to install the locally built Angular packages,
whose checksums will be different from the ones in the lockfile.
Therefore, we have to manually ensure that the lockfiles remain in-sync
with the corresponding `package.json` files for the rest of the
dependencies.

For example, previously, [cli-hello-world-lazy/yarn.lock][1] had an
entry for `@angular-devkit/build-angular@0.900.0-next.9` (pinned to
`0.900.0-next.9`), but [cli-hello-world-lazy/package.json][2] specified
the `@angular-devkit/build-angular` version as `^0.900.0-rc.0` (note the
leading caret). As a result, since the version in the lock file does not
much the one in `package.json`, the lockfile is ignored and the latest
available version that matches `^0.900.0-rc.0` is installed.

This, for example, started causing unrelated CI failures ([example][3]),
when `@angular-devkit/build-angular@9.0.0-rc.3` was released with a size
improvement.

This commit ensures that all integration projects have a lockfile and
that lockfiles are up-to-date (with the current `package.json` files).

[1]: https://github.com/angular/angular/blob/fc2f6b845/integration/cli-hello-world-lazy/yarn.lock#L13
[2]: https://github.com/angular/angular/blob/fc2f6b845/integration/cli-hello-world-lazy/package.json#L26
[3]: https://circleci.com/gh/angular/angular/535959#tests/containers/2

PR Close #33968
2019-11-26 16:08:33 -08:00
e8ec296fdd fix(language-service): determine index types accessed using dot notation (#33884)
Commit 53fc2ed8bf added support for
determining index types accessed using index signatures, but did not
include support for index types accessed using dot notation:

```typescript
const obj<T>: { [key: string]: T };
obj['stringKey']. // gets `T.` completions
obj.stringKey.    // did not peviously get `T.` completions
```

This adds support for determining an index type accessed via dot
notation by rigging an object's symbol table to return the string index
signature type a property access refers to, if that property does not
explicitly exist on the object. This is very similar to @ivanwonder's
work in #29811.

`SymbolWrapper` now takes an additional parameter to explicitly set the
type of the symbol wrapped. This is done because
`SymbolTableWrapper#get` only has access to the symbol of the index
type, _not_ the index signature symbol itself. An attempt to get the
type of the index type will give an error.

Closes #29811
Closes https://github.com/angular/vscode-ng-language-service/issues/126

PR Close #33884
2019-11-26 16:06:02 -08:00
4745aef9e8 build: remove remaining internal references to define=compile flag (#33983)
Now that all compile decisions are determined by the define=angular_ivy_enabled
flag, we can remove the setting of the define=compile flag throughout the repo.

PR Close #33983
2019-11-26 16:38:41 -05:00
a122311773 build: migrate determining if Ivy is enabled in typescript genrule files to use angular_ivy_enabled (#33983)
Use angular_ivy_enabled to determine if Ivy is being used for the ivy_test_selector.ts symbols.
Additionally, remove the reflect_metadata genrules as we not longer have a "jit" compile option
so all possible invocations result in the same generated file.  Instead we can just commit this
file.

PR Close #33983
2019-11-26 16:38:41 -05:00
6bf258178d build: update scripting and tooling to rely on define=angular_ivy_enabled instream of define=compile (#33983)
We need to migrate to using angular_ivy_enabled value to determine whether to use
Ivy or ViewEngine for package building scripts and for size-tracking and
symbol-extract tooling.

PR Close #33983
2019-11-26 16:38:41 -05:00
fec9f7dce5 build: migrate references and scripts that set to build with ivy via compile=aot to use config=ivy (#33983)
Since config=ivy now sets the define=compile flag and the define=angular_ivy_enabled
flag to cause usage of Ivy, we can update all of the documentation and scripts that
reference compile=aot to use config=ivy.

PR Close #33983
2019-11-26 16:38:41 -05:00
d2784c7894 build: create --config=ivy flag to set the angular_ivy_enabled define flag value (#33983)
Beginning of migration away from --define=compile=* to --define=angular_ivy_enabled=*.
Additionally, to make it clearer to developers, we will encourage use of --config=ivy
instead of directy setting the --define flag, this abstraction will allow us more
flexibility as we move foward with relation to our compile decisions at build time.

PR Close #33983
2019-11-26 16:38:41 -05:00
5cc362fbbf docs: update injectable migration guide to reflect latest schematic changes (#33960)
Since we created the migration guide for the `missing-injectable` schematic, the schematic
changed in various ways. e.g. the migration no longer migrates classes passed to `useExisting`

Additionally the migration has been expanded to handle another Ivy breaking change where
providers like `{provide: X}` will be intepreted as `{provide: X, useClass: X}`. This pattern should
be documented in the migration guide.

PR Close #33960
2019-11-26 16:37:48 -05:00
dee0c33a1d docs: fix typo in sample (#33984)
Fixes #33979

PR Close #33984
2019-11-26 16:37:17 -05:00
1d14f85dd6 docs: add note about strictTemplates and strictNullChecks together (#34039)
PR Close #34039
2019-11-26 16:36:51 -05:00
5e530e917b docs: removed non-supported versions from LTS (#34005)
PR Close #34005
2019-11-26 16:36:23 -05:00
781003fd2f fix(ivy): support ICUs without "other" cases (#34042)
Prior to this commit, there was a runtime check in i18n logic to make sure "other" case is always present in an ICU. That was not a requirement in View Engine, so ICUs that previously worked may produce errors. This commit removes that restriction and adds support for ICUs without "other" cases.

PR Close #34042
2019-11-26 16:35:55 -05:00
cbc28f255d ci: fix code ownership for size tracking (#34044)
It should be set up so either Igor OR Kara can approve
size tracking rather than both.

PR Close #34044
2019-11-26 16:35:27 -05:00
8a565c8814 feat(language-service): completions support for indexed types (#34047)
Previously, indexing a container type would not return completions for
the indexed type because for every TypeScript type, the recorded index
type was always marked as `undefined`, regardless of the index
signature.

This PR now returns the index type of TypeScript containers with numeric
or string index signatures. This allows use to generate completions for
arrays and defined index types:

```typescript
interface Container<T> {
  [key: string]: T;
}
const ctr: Container<T>;
ctr['stringKey']. // gives `T.` completions

const arr: T[];
arr[0]. // gives `T.` completions
```

Note that this does _not_ provide completions for properties indexed by
string literals, e.g.

```typescript
interface Container<T> {
  foo: T;
}
const ctr: Container<T>;
ctr['foo']. // does not give `T.` completions
```

Closes angular/vscode-ng-language-service#110
Closes angular/vscode-ng-language-service#277

PR Close #34047
2019-11-26 16:27:52 -05:00
d228801af4 perf(ivy): do no work if moving a viewRef to the same position (#34052)
Move a view only if it would end up at a different place.
Otherwise we would do unnecessary processing like DOM manipulation, query notifications etc.

Thanks to @pkozlowski-opensource for the change.

PR Close #34052
2019-11-26 16:27:27 -05:00
978b500961 fix(ivy): support inserting a viewRef that is already present (#34052)
When inserting a `viewRef` it is possible to not provide
an `index`, which is regarded as appending to the end of
the container.

If the `viewRef` already exists in the container, then
this results in a move. But there was a fault in the logic
that computed where to insert the `viewRef` that did not
account for the fact that the `viewRef` was already in
the container, so the insertion `index` was outside the
bounds of the array.

Fixes #33924

PR Close #34052
2019-11-26 16:27:27 -05:00
b659aa32c9 fix(ivy): take styles extracted from template into account in JIT mode (#34017)
Prior to this commit, all styles extracted from Component's template (defined using <style> tags) were ignored by JIT compiler, so only `styles` array values defined in @Component decorator were used. This change updates JIT compiler to take styles extracted from the template into account. It also ensures correct order where `styles` array values are applied first and template styles are applied second.

PR Close #34017
2019-11-25 22:38:42 -05:00
1d513e8978 docs: add Animations import in Router doc (#33740)
Fixes #33665

PR Close #33740
2019-11-25 22:37:55 -05:00
d22f3d6f85 fix(language-service): function.bind() should not be an error (#34041) (#34046)
When performing diagnostic checks or completions, we should take into
account members and properties in the base class, if any. Otherwise, the
language service will produce a false error.

PR closes https://github.com/angular/vscode-ng-language-service/issues/93

PR Close #34041

(cherry picked from commit 7cd16b9e2c)

PR Close #34046
2019-11-25 22:37:29 -05:00
bbc8b0f142 build: update payload limits for cli-hello-world-ivy-i18n es2015 bundle (#34043)
Commit that removes wtf* apis (ed55355363) decreased es2015 bundle for `cli-hello-world-ivy-i18n` app (was: 138032, actual: 137209). This commit updates the `_payload-limits.json` file to reflect that.

PR Close #34043
2019-11-25 20:50:41 -05:00
ebe3229da5 fix(ivy): run pre-order hooks in injection order (#34026)
This commit fixes a compatibility bug where pre-order lifecycle
hooks (onInit, doCheck, OnChanges) for directives on the same
host node were executed based on the order the directives were
matched, rather than the order the directives were instantiated
(i.e. injection order).

This discrepancy can cause issues with forms, where it is common
to inject NgControl and try to extract its control property in
ngOnInit. As the NgControl directive is injected, it should be
instantiated before the control value accessor directive (and
thus its hooks should run first). This ensures that the NgControl
ngOnInit can set up the form control before the ngOnInit
for the control value accessor tries to access it.

Closes #32522

PR Close #34026
2019-11-25 18:41:22 -05:00
caf5cffd53 docs: edit EventEmitter name in styleguide (#33923)
Fixes #33890

PR Close #33923
2019-11-25 18:40:51 -05:00
cf420194ed fix(core): remove deprecated and defunct wtf* apis (#33949)
These apis have been deprecated in v8, so they should stick around till v10,
but since they are defunct we are removing them early so that they don't take up payload size.

PR Close #33949
2019-11-25 18:39:18 -05:00
420750bd05 docs: fix typos in compiler API comments (#33977)
PR Close #33977
2019-11-25 18:38:47 -05:00
7d8b112a91 ci: do not check/upload packages-dist/ UMD bundle sizes multiple times (#33987)
At the end of the `integration/run_tests.sh` script, we check and upload
the payload sizes of UMD bundles in `dist/packages-dist/`. At some
point, we started sharding the integration tests on CI to speed the
overall build time. As a result, checking and uploading of UMD bundle
sizes was run multiple times (once per shard).

Given that the data is identical on each shard, the data was just
overwriting the previously uploaded data. Even if the end result is the
same, checking and uploading the data multiple times is wasteful.

This commit fixes `integration/run_tests.sh` to only check/upload UMD
bundle sizes on the 1st shard.

PR Close #33987
2019-11-25 16:36:07 -05:00
abb8c90df9 ci: remove change type from uploaded payload size data (#33987)
The change type was only recorded for `aio/` and was not correct anyway.
For example:
- It considered `package.json` changes as `application` (even if only
  `package.json` and `yarn.lock` had changed).
- It failed to account for changes in `@angular/*` dependencies, when
  using the locally built Angular packages (instead reporting them as
  `other`).
- It only looked at the last commit, so it failed to provide accurate
  information for multi-commit builds (which are rare, but possible).

For the above reasons (and because there is no straight-forward way of
fixing it), this commit removes the change type from the uploaded data.
If necessary, it is still possible to find the type of changes from the
uploaded info (e.g. extract the associated commits and look at their
changes using git).

PR Close #33987
2019-11-25 16:36:07 -05:00
efd626c4bc ci: always track and check payload size data for angular.io (#33987)
As part of the `payload-size` npm script in `aio/package.json` (which is
run on CI), the sizes of the angular.io app bundles are checked to
ensure they do not exceed certain limits and are also uploaded to
Firebase to be available for later analysis. The uploaded data include
the type of the changes (dependencies only, application only, or both).
The type of changes is inferred by looking at the files that have
changed inside the `aio/` directory.

When the `payload-size.sh` script was first introduced, the only files
that could affect bundle sizes were inside the `aio/` directory.
Therefore, the script would skip uploading the data and checking the
sizes if no changes were detected inside the `aio/` directory.

However, this assumption stopped being valid over time. For example:
- We started tracking/checking bundle sizes when building the angular.io
  app with the locally built Angular packages (which live outside the
  `aio/` directory.
- Due to CircleCI limitations, the `CI_COMMIT_RANGE` environment
  variable (which is used for determining what files have been affected)
  stopped reflecting the whole commit range of the build and only
  included the last commit instead.

Based on the above, there were many cases were size data would not be
uploaded to Firebase, even when they may have been affected (because the
affecting changes were outside `aio/` - e.g. in framework packages).
This makes it harder to analyze size regressions, because important
data-points are missing.

Even worse, in these cases, the sizes were not even checked against the
specified limits, thus making it possible for size regressions to go
unnoticed (unless caught by other similar tests).

This commit fixes the `scripts/ci/payload-size.sh` script to always
track and check payload sizes for angular.io bundles.

NOTE: This change will result in more data being recorded (i.e.
      recording data when it is not possible for the bundle sizes to
      have been affected by the changes). This is still preferable to
      failing to record and/or check when sizes could have been
      affected.

PR Close #33987
2019-11-25 16:36:07 -05:00
8c2ff79d04 docs: initial Ivy i18n guide updates (#33762)
PR Close #33762
2019-11-25 14:12:19 -05:00
457ac3ac46 perf(ivy): fix creation time micro-benchmarks (#34031)
Micro-benchmarks were broken after we've introduced concept of
DECLARATION_COMPONENT_VIEW on LView (after this change embedded
views must have a pointer to a parent LView).

PR Close #34031
2019-11-25 12:47:58 -05:00
688b188484 build: remove compile_strategy from ng_module.bzl (#33999)
With the migration of internal i18n rule to use is_ivy_enabled complete, we
can remove compile_strategy as it is now unused.

PR Close #33999
2019-11-25 11:48:25 -05:00
f63fca1e3a ci: verify no unintentional circleci config changes (#33737)
PR Close #33737
2019-11-25 11:41:54 -05:00
60570d0cb2 refactor(ivy): extract elementStart first create pass (#33963)
PR Close #33963
2019-11-25 11:41:17 -05:00
00f1ffbbb4 refactor(ivy): remove isRootView check from getRenderParent (#33988)
The root view case is already covered by the existing code in the
getRenderParent function so no need to have an explicit checks
(and associated memory reads) again.

PR Close #33988
2019-11-25 11:40:37 -05:00
9d41b5bdd4 docs(docs-infra): fix typos and spelling in the stackblitz-builder/README.md (#34009)
PR Close #34009
2019-11-25 11:39:05 -05:00
83989b879b fix(ngcc): render UMD global imports correctly (#34012)
The current UMD rendering formatter did not handle
a number of corner cases, such as imports from namespaced
packages.

PR Close #34012
2019-11-25 11:38:36 -05:00
290739f301 docs: fix typos and highlight booleans to keep consistency (#34013)
PR Close #34013
2019-11-25 11:38:06 -05:00
8ed7b73dc1 docs: replace class hero to interface wherever class properties not used (#34022)
Fixes #21186

PR Close #34022
2019-11-25 11:37:40 -05:00
7b77ead88f ci: add JoostK to @angular/fw-compiler (#33994)
also add Kara and AndrewK who are in the GH group but not in the file listing.

PR Close #33994
2019-11-22 18:40:38 -05:00
27f775a65d docs: add TracyLee to GDE list (#33947)
PR Close #33947
2019-11-22 18:40:03 -05:00
f2bb9cc95e build: make ng_module.bzl is_ivy_enabled function public (#33992)
We need to make is_ivy_enabled public to allow the internal i18n
build rule to rely on it rather than relying on compile_strategy.
After we move the internal i18n rule to rely on is_ivy_enabled,
compile_strategy can then be removed.

PR Close #33992
2019-11-22 18:30:54 -05:00
9248dba8fa docs: Add Joey Perrott to Angular team in contributors (#33962)
PR Close #33962
2019-11-22 17:40:03 -05:00
1ffbde14ab fix(ivy): track changes across failed builds (#33971)
Previously, our incremental build system kept track of the changes between
the current compilation and the previous one, and used its knowledge of
inter-file dependencies to evaluate the impact of each change and emit the
right set of output files.

However, a problem arose if the compiler was not able to extract a
dependency graph successfully. This typically happens if the input program
contains errors. In this case the Angular analysis part of compilation is
never executed.

If a file changed in one of these failed builds, in the next build it
appears unchanged. This means that the compiler "forgets" to emit it!

To fix this problem, the compiler needs to know the set of changes made
_since the last successful build_, not simply since the last invocation.

This commit changes the incremental state system to much more explicitly
pass information from the previous to the next compilation, and in the
process to keep track of changes across multiple failed builds, until the
program can be analyzed successfully and the results of those changes
incorporated into the emit plan.

Fixes #32214

PR Close #33971
2019-11-22 17:39:35 -05:00
4946be0b35 build: change visible compiler name during ng_module builds to be Ivy/ViewEngine (#33995)
Previously the visible compiler name during the ng_module build action was
ngc/ngtsc.  These names however are only really known to the compiler team.
Instead we should use more general terms for which compiler is used to match
how we speak about compiler choices.

PR Close #33995
2019-11-22 17:37:40 -05:00
274ed2ca74 docs: fix typo in the aio/README.md (#33993)
PR Close #33993
2019-11-22 17:37:15 -05:00
21ec7d92dd refactor(elements): ng-add schematics (#33723)
This PR brings a couple of changes;
- Removes undeed dependencies in bazel targets such as `//packages/common` & `//packages/core`
- Removes RxJs usage
- Adds `document-register-element` to architect test targets
- Use @schematics/angular helpers
- Uses the standard `$source": "projectName"` to get the projectName, which is defined in the `schema.json`
- Use workspace writer to update the workspace config

PR Close #33723
2019-11-22 17:36:47 -05:00
85a4a1ac60 refactor(bazel): use getattr instead of hasattr in ng_module.bzl (#33765)
getattr improves code readability and makes the code also shorter.

PR Close #33765
2019-11-22 16:52:09 -05:00
e24ed8d0e2 fix(bazel): ng_module should not emit shim files under bazel and Ivy (#33765)
Under bazel and Ivy we don't need the shim files to be emmited by default.

We still need to the shims for blaze however because google3 code imports them.

This improves build latency by 1-2 seconds per ng_module target.

PR Close #33765
2019-11-22 16:52:09 -05:00
229bfd507f build: add integration/platform-server/node_modules to .bazelignore (#33765)
the node_modules contains rxjs which contains invalid bazel files which break bazel query executed on //...

PR Close #33765
2019-11-22 16:52:09 -05:00
af77e5289d ci: tighten size threshold to 1% or 500 bytes (#33969)
The size diff threshold of 1% has proven to be too lenient for us
to catch size regressions in AIO. Since the AIO main bundle is
between 400-500 KB, a size regression must be between 4-5 KB before
it will cause the tests to fail. As a result, we may merge many
changes with smaller regressions of a few KB before the size test
eventually lets us know that the number has increased. The hope is
that lowering the threshold will help us catch the smaller
regressions during code review and prevent the size tests failing at
a random later time when someone catches the size "hot potato".

PR Close #33969
2019-11-22 16:51:41 -05:00
b4c839ccb9 ci: tighten code owners for size tracking (#33969)
It will be easier to track regressions in size if fewer people
are approving size diffs in PRs. That way, we will have a few
people that have a fuller picture of where size changes are
coming from.

PR Close #33969
2019-11-22 16:51:41 -05:00
99e68d0318 ci: use more descriptive names for published build artifacts (#33957)
In efbbae5a4, the `publish_packages_as_artifacts` CircleCI job was
created to publish the build artifacts of PR builds on CI. In a8f4f14bd,
its scope was expanded to also publish build artifacts on non-PR builds.

The published artifacts names are constructed based on the PR number
(e.g. include `-pr12345-`), so on non-PR builds the names do not reflect
the source branch (instead, they include `-prfalse-`).

This commit fixes this by using the current branch name. For example,
artifact names for the `master` or `9.0.x` branch will include
`-master-` and `-9.0.x-` respectively (instead of `-prfalse-`).
(NOTE: For PRs, where branch name is `pull/12345`, the branch name is
transformed to `pr12345`.)

PR Close #33957
2019-11-22 14:05:52 -05:00
971228b4f4 fix(docs-infra): update manifest short_name (#30194)
PR Close #30194
2019-11-22 13:20:47 -05:00
bda3c2245d fix(docs-infra): update manifest names (#30194)
update manifest names to better indicate what the installable application is, fixes #30192
PR Close #30194
2019-11-22 13:20:47 -05:00
63c9123924 fix(service-worker): allow creating post api requests after cache failure (#33930)
Before creating a mutating http request, service-worker
invalidates lru cache entry and writes to cache storage.
Therefore, cache storage failure can prevent making post requests.
Fix this by catching and logging cache error, add a test case.

Fixes #33793

PR Close #33930
2019-11-22 13:15:57 -05:00
aa4d2b785b refactor(service-worker): set http method in MockRequest constructor (#33930)
Enable to create mocks for mutating http requests in tests
to check more scenarios.

PR Close #33930
2019-11-22 13:15:57 -05:00
719ca1d23c fix(bazel): update to tsickle 0.37.1 to fix peerDep warnings (#33788)
tsickle 0.37.1 is compatible with typescript 3.6, so we should use it and fix peerDep warnings from npm/yarn.

PR Close #33788
2019-11-22 13:13:01 -05:00
18574cfed1 docs: add examples for DI change in Ivy (#33643)
PR Close #33643
2019-11-22 13:04:24 -05:00
ad9b9a3534 docs: add santosh yadav as GDE resource (#33818)
PR Close #33818
2019-11-22 12:45:52 -05:00
a54096ab5b docs(core): fix typo in Tour of Heroes App and Tutorial (#33931)
PR Close #33931
2019-11-22 12:45:04 -05:00
e456e5833a fix(ngcc): do not crash on packages that specify typings as an array (#33973)
In a package.json file, the "typings" or "types" field could be an array
of typings files. ngcc would previously crash unexpectedly for such
packages, as it assumed that the typings field would be a string. This
commit lets ngcc skip over such packages, as having multiple typing
entry-points is not supported for Angular packages so it is safe to
ignore them.

Fixes #33646

PR Close #33973
2019-11-22 12:40:04 -05:00
4a42be27ee docs: update npm install dev command to npm install --save-dev (#33985)
See: https://docs.npmjs.com/specifying-dependencies-and-devdependencies-in-a-package-json-file

PR Close #33985
2019-11-22 12:38:17 -05:00
9719047df8 docs(http): fix typo (#33978)
PR Close #33978
2019-11-22 12:36:43 -05:00
f1bf5b26d1 fix(router): make routerLinkActive work with query params which contain arrays (#22666)
The url_tree equalQueryParams and containsQueryParam methods did not handle query params that has arrays, which resulted in the routerLinkActive to not behave as expected, change was made to ensure query params with arrays are handled correctly

fixes #22223

PR Close #22666
2019-11-21 20:02:33 -05:00
a528006d7a build: bump check version requirements for bazel and rules_nodejs (#33966)
PR Close #33966
2019-11-21 19:49:02 -05:00
c1c04dc8ad build: create bazel define flag, angular_ivy_enabled, to build using ivy (#33975)
This introduces a second possible define flag for informing bazel to build with ivy, but
does not remove the old `compile=aot` flag for configuration.

This is the first step in migrating away from using the `compile=aot` define flag.

PR Close #33975
2019-11-21 19:46:57 -05:00
90a9043abb fix(ivy): remove TNodeType assertion from directiveInject instruction (#33948)
The assertion that we have in the `directiveInject` instruction is too restrictive and we came across some pattern where it throws unnecessarily. This commit removes that assertion for now and more detailed investigation is needed to decide is we need to restrict the set of TNodeType again.

This commit also adds a test which triggered the TNodeType.View to come up in the `directiveInject` instruction, so it might be useful to avoid regressions during further refactoring.

PR Close #33948
2019-11-21 17:09:42 -05:00
a172644c6c docs: add CSRF to XSRF section of http guide (#32933)
link to the correct section of the HttpClientGuide:
if someone searches for CSRF (and not XSRF), she will not find the right section in the HttpClient guide

added CSRF as name of XSRF attack:
in order to make it easier to find the XSRF protection, I've added a reference to the other name "CSRF". The security guide has the same reference to XSRF/CSRF.
When I searched for this feature, I had quite some problems to find it because of this missing reference

PR Close #32933
2019-11-21 16:57:13 -05:00
d3825c20d5 docs: add martina kraus to GDE resources (#33719)
PR Close #33719
2019-11-21 16:52:32 -05:00
c01fa1823f fix(docs-infra): change search input width when focused (#33804)
The search input has 50% width of the parent container in a focused
state for the big break point (> 1000px). In this case when window width
is between 1000px and 1115px the search input shrinks from 180 to
~123px. The width of the search input was increased to 80% so that when
focused its width expands from 180 to 196px when window size is 1000px.

Fixes #33305

PR Close #33804
2019-11-21 16:51:06 -05:00
9a5334c75e ci: set up window CI to use remote http caching (#33970)
PR Close #33970
2019-11-21 16:43:42 -05:00
250e6fdd39 fix(service-worker): throw when using the unsupported versionedFiles option in config (#33903)
In 5d5c94d83, the deprecated `versionedFiles` option from the SW
asset-group configuration in `ngsw-config.json`. As a result, the
option would be silently ignored and the runtime behavior of the SW
would change (i.e. some files might not be cached and available offline
any more). This change could be easily go unnoticed by the developer.

This commit ensures this does not happen by throwing a build-time error,
when detecting the unsupported `versionedFiles` option with an error
message prompting the user to use the `files` option instead.

Jira issue: [FW-1727](https://angular-team.atlassian.net/browse/FW-1727)

PR Close #33903
2019-11-21 11:43:58 -08:00
196808eebb refactor(service-worker): use async/await in SW config tests (#33903)
PR Close #33903
2019-11-21 11:43:58 -08:00
c6695faf47 fix(ngcc): render localized strings when in ES5 format (#33857)
Recently the ngtsc translator was modified to be more `ScriptTarget`
aware, which basically means that it will not generate non-ES5 code
when the output format is ES5 or similar.

This commit enhances that change by also "downleveling" localized
messages. In ES2015 the messages use tagged template literals, which
are not available in ES5.

PR Close #33857
2019-11-21 10:54:59 -08:00
3814674f9a build: update setup-rbe.sh script and documentation to remove http-remote-cache config (#33907)
We have determined that the upload time cost of remote caching via http is too costly
to be effective for our distributed usage scenario.  However this cost is still worth
it for us for Windows CI runs on a full cache hit move from a ~60 minute task to ~10
minutes.

It is worth noting that this remote http-caching is entirely separate from RBE caching
mechanisms.

PR Close #33907
2019-11-21 10:45:58 -08:00
e17f051601 docs: clarify that --prod should be used to publish a library (#33959)
PR Close #33959
2019-11-21 10:45:18 -08:00
ca5d7723ff fix(ngcc): report errors from analyze and resolve processing (#33964)
Previously, these errors were being swallowed, which made it
hard to debug problems with packages.

See https://github.com/angular/angular/issues/33685#issuecomment-557091719

PR Close #33964
2019-11-21 10:44:24 -08:00
1394781cef build: update @schematics/angular to 9.0.0-rc.3 (#33955)
PR Close #33955
2019-11-21 09:17:19 -08:00
197f042fb1 build: update to Angular CLI 9.0.0-rc.3 (#33955)
Followup to https://github.com/angular/angular/pull/33337

PR Close #33955
2019-11-21 09:17:19 -08:00
fc6ad19089 fix(ivy): wrap functions from "providers" in parentheses in Closure mode (#33609)
Due to the fact that Tsickle runs between analyze and transform phases in Angular, Tsickle may transform nodes (add comments with type annotations for Closure) that we captured during the analyze phase. As a result, some patterns where a function is returned from another function may trigger automatic semicolon insertion, which breaks the code (makes functions return `undefined` instead of a function). In order to avoid the problem, this commit updates the code to wrap all functions in some expression ("privders" and "viewProviders") in parentheses. More info can be found in Tsickle source code here: d797426257/src/jsdoc_transformer.ts (L1021)

PR Close #33609
2019-11-20 14:58:36 -08:00
90cd9682d2 docs: add learning resource (#33730)
PR Close #33730
2019-11-20 14:56:56 -08:00
80ecf12b4b docs: Update Alyssa on GDE list (#33538)
PR Close #33538
2019-11-20 14:52:00 -08:00
b12fde4ceb fix(ivy): avoid infinite recursion when evaluation source files (#33772)
When ngtsc comes across a source file during partial evaluation, it
would determine all exported symbols from that module and evaluate their
values greedily. This greedy evaluation strategy introduces unnecessary
work and can fall into infinite recursion when the evaluation result of
an exported expression would circularly depend on the source file. This
would primarily occur in CommonJS code, where the `exports` variable can
be used to refer to an exported variable. This variable would be
resolved to the source file itself, thereby greedily evaluating all
exported symbols and thus ending up evaluating the `exports` variable
again. This variable would be resolved to the source file itself,
thereby greedily evaluating all exported symbols and thus ending u
evaluating the `exports` variable again. This variable would be
resolved to the source file itself, thereby greedily evaluating all
exported symbols and thus ending up evaluating the `exports` variable
again. This variable would be resolved to the source file itself,
thereby greedily evaluating all exported symbols and thus ending up
evaluating the `exports` variable again. This went on for some time
until all stack frames were exhausted.

This commit introduces a `ResolvedModule` that delays the evaluation of
its exports until they are actually requested. This avoids the circular
dependency when evaluating `exports`, thereby fixing the issue.

Fix #33734

PR Close #33772
2019-11-20 14:51:38 -08:00
94257ac8d3 fix(ivy): handle non-standard input/output names in template type checking (#33741)
The template type checker generates code to check directive inputs and
outputs, whose name may contain characters that can not be used as
identifier in TypeScript. Prior to this change, such names would be
emitted into the generated code as is, resulting in invalid code and
unexpected template type check errors.

This commit fixes the bug by representing the potentially invalid names
as string literal instead of raw identifier.

Fixes #33590

PR Close #33741
2019-11-20 14:51:12 -08:00
fbd2133610 fix(ivy): avoid using stale cache in TestBed if module overrides are defined (#33787)
NgModule compilation in JIT mode (that is also used in TestBed) caches module scopes on NgModule defs (using `transitiveCompileScopes` field). Module overrides (defined via TestBed.overrideModule) may invalidate this data by adding/removing items in `declarations` list. This commit forces TestBed to recalculate transitive scopes in case module overrides are present, so TestBed always gets the most up-to-date information.

PR Close #33787
2019-11-20 14:50:28 -08:00
a09d60cb50 docs: add api doc to sub-packages (#33801)
PR Close #33801
2019-11-20 14:48:50 -08:00
61cc7a3437 fix(core): allow css custom variables/properties in the style sanitizer (#33841)
This change enables "var(--my-var)" to pass through the style sanitizer.

After consulation with our security team, allowing these doesn't create
new attack vectors, so the sanitizer doesn't need to strip them.

Fixes parts of #23485 related to the sanitizer, other use cases discussed
there related to binding have been addressed via other changes to the
class and style handling in the runtime.

Closes #23485

PR Close #33841
2019-11-20 14:48:00 -08:00
4e0eb3627d style(core): improve readability of style_sanizer(_spec).ts (#33841)
PR Close #33841
2019-11-20 14:48:00 -08:00
05a18cc4cb perf(ivy): R3TestBed - Do not process NgModuleDefs that have already been processed (#33863)
PR Close #33863
2019-11-20 14:47:42 -08:00
6da5230003 docs: add doc reference to npm package readme (#33911)
PR Close #33911
2019-11-20 14:46:23 -08:00
b8ba6b036c fix(ivy): reset style property using ngStyle fix (#33920)
PR Close #33920
2019-11-20 14:46:00 -08:00
b31afc2aa9 test(ivy): non-regression test for ViewContainerRef queried on ng-container (#33939)
Closes #31971

PR Close #33939
2019-11-20 14:45:43 -08:00
3b5e1668ed fix(docs-infra): fix StackBlitz and zipped http examples (#33941)
Previously, the generated StackBlitz examples as well as the
corresponding downloadable zips for the `http` guide examples were not
correct and thus trying to run the app and/or tests would fail.

This commit fixes the examples:

- Replace `TestBed.inject()` (which was [introduced in v9][1]) with
  `TestBed.get()` (which is available in v8 used in the examples).
  (NOTE: The examples will soon be updated to v9 (as part of
  [FW-1609][2] and switched back to `TestBed.inject()` then.)

- Include `src/app/heroes/hero.ts` in the zip, because it is referenced
  by some of the other files and the compilation fails without it.

- Ensure `src/main-specs.ts` is not included in the zip that does not
  include the tests. Including the file broke the app, because there is
  logic in our zip-builder that renamed `main-*.ts` files to `main.ts`
  and thus `main-specs.ts` ended up overwriting the actual `main.ts`.

[1]: https://next.angular.io/guide/deprecations#angularcoretesting
[2]: https://angular-team.atlassian.net/browse/FW-1609

Fixes #33874
Fixes #33945

PR Close #33941
2019-11-20 14:44:31 -08:00
7c7d432085 release: cut the v9.0.0-rc.3 release 2019-11-20 14:18:59 -08:00
213e3c3e49 fix(ivy): move setClassMetadata calls into a pure iife (#33337)
This commit transforms the setClassMetadata calls generated by ngtsc from:

```typescript
/*@__PURE__*/ setClassMetadata(...);
```

to:

```typescript
/*@__PURE__*/ (function() {
  setClassMetadata(...);
})();
```

Without the IIFE, terser won't remove these function calls because the
function calls have arguments that themselves are function calls or other
impure expressions. In order to make the whole block be DCE-ed by terser,
we wrap it into IIFE and mark the IIFE as pure.

It should be noted that this change doesn't have any impact on CLI* with
build-optimizer, which removes the whole setClassMetadata block within
the webpack loader, so terser or webpack itself don't get to see it at
all. This is done to prevent cross-chunk retention issues caused by
webpack's internal module registry.

* actually we do expect a short-term size regression while
https://github.com/angular/angular-cli/pull/16228
is merged and released in the next rc of the CLI. But long term this
change does nothing to CLI + build-optimizer configuration and is done
primarly to correct the seemingly correct but non-function PURE annotation
that builds not using build-optimizer could rely on.

PR Close #33337
2019-11-20 12:55:58 -08:00
5267c92a93 fix(ivy): retain JIT metadata unless JIT mode is explicitly disabled (#33671)
NgModules in Ivy have a definition which contains various different bits
of metadata about the module. In particular, this metadata falls into two
categories:

* metadata required to use the module at runtime (for bootstrapping, etc)
in AOT-only applications.
* metadata required to depend on the module from a JIT-compiled app.

The latter metadata consists of the module's declarations, imports, and
exports. To support JIT usage, this metadata must be included in the
generated code, especially if that code is shipped to NPM. However, because
this metadata preserves the entire NgModule graph (references to all
directives and components in the app), it needs to be removed during
optimization for AOT-only builds.

Previously, this was done with a clever design:

1. The extra metadata was added by a function called `setNgModuleScope`.
A call to this function was generated after each NgModule.
2. This function call was marked as "pure" with a comment and used
`noSideEffects` internally, which causes optimizers to remove it.

The effect was that in dev mode or test mode (which use JIT), no optimizer
runs and the full NgModule metadata was available at runtime. But in
production (presumably AOT) builds, the optimizer runs and removes the JIT-
specific metadata.

However, there are cases where apps that want to use JIT in production, and
still make an optimized build. In this case, the JIT-specific metadata would
be erroneously removed. This commit solves that problem by adding an
`ngJitMode` global variable which guards all `setNgModuleScope` calls. An
optimizer can be configured to statically define this global to be `false`
for AOT-only builds, causing the extra metadata to be stripped.

A configuration for Terser used by the CLI is provided in `tooling.ts` which
sets `ngJitMode` to `false` when building AOT apps.

PR Close #33671
2019-11-20 12:55:43 -08:00
595375f7a3 fix(ivy): don't infer template context types when in full mode (#33537)
The Ivy template type-checker is capable of inferring the type of a
structural directive (such as NgForOf<T>). Previously, this was done with
fullTemplateTypeCheck: true, even if strictTemplates was false. View Engine
previously did not do this inference, and so this causes breakages if the
type of the template context is not what the user expected.

In particular, consider the template:

```html
<div *ngFor="let user of users as all">
  {{user.index}} out of {{all.length}}
</div>
```

As long as `users` is an array, this seems reasonable, because it appears
that `all` is an alias for the `users` array. However, this is misleading.

In reality, `NgForOf` is rendered with a template context that contains
both a `$implicit` value (for the loop variable `user`) as well as a
`ngForOf` value, which is the actual value assigned to `all`. The type of
`NgForOf`'s template context is `NgForContext<T>`, which declares `ngForOf`'s
type to be `NgIterable<T>`, which does not have a `length` property (due to
its incorporation of the `Iterable` type).

This commit stops the template type-checker from inferring template context
types unless strictTemplates is set (and strictInputTypes is not disabled).

Fixes #33527.

PR Close #33537
2019-11-20 11:47:42 -08:00
d92da1335d fix(ivy): report watch mode diagnostics correctly (#33862)
This commit changes the reporting of watch mode diagnostics for ngtsc to use
the same formatting as non-watch mode diagnostics. This prints rich and
contextual errors even in watch mode, which previously was not the case.

Fixes #32213

PR Close #33862
2019-11-20 11:46:02 -08:00
30ddadc4d7 fix(ivy): always re-analyze the program during incremental rebuilds (#33862)
Previously, the ngtsc compiler attempted to reuse analysis work from the
previous program during an incremental build. To do this, it had to prove
that the work was safe to reuse - that no changes made to the new program
would invalidate the previous analysis.

The implementation of this had a significant design flaw: if the previous
program had errors, the previous analysis would be missing significant
information, and the dependency graph extracted from it would not be
sufficient to determine which files should be re-analyzed to fill in the
gaps. This often meant that the build output after an error was resolved
would be wholly incorrect.

This commit switches ngtsc to take a simpler approach to incremental
rebuilds. Instead of attempting to reuse prior analysis work, the entire
program is re-analyzed with each compilation. This is actually not as
expensive as one might imagine - analysis is a fairly small part of overall
compilation time.

Based on the dependency graph extracted during this analysis, the compiler
then can make accurate decisions on whether to emit specific files. A new
suite of tests is added to validate behavior in the presence of source code
level errors.

This new approach is dramatically simpler than the previous algorithm, and
should always produce correct results for a semantically correct program.s

Fixes #32388
Fixes #32214

PR Close #33862
2019-11-20 11:46:02 -08:00
dc8e300029 test(ivy): driveDiagnostics() works incrementally (#33862)
PR Close #33862
2019-11-20 11:46:02 -08:00
a7e2327212 test(docs-infra): more thoroughly clean up after ScrollService tests (#33937)
By clearing `sessionStorage` and unsubscribing from `Location` events,
after each test, we reduce the possibility of potential
[spooky action at a distance][1]-type of failures in the future.

This does not have an impact on the actual app, since `ScrollService` is
currently expected to live throughout the lifetime of the app. Still,
unsubscribing from `Location` events keeps the code consistent with how
other `ScrollService` listeners are handled (e.g. for `window` events).

[1]: https://en.wikipedia.org/wiki/Action_at_a_distance_(computer_programming)

PR Close #33937
2019-11-20 11:04:12 -08:00
a7d6829cde test(docs-infra): destroy all ScrollService instances after each test (#33937)
`ScrollService` subscribes to global `window` events and mutates global
state in the listener (e.g. read/write values from/to `sessionStorage`).
Therefore, we need to always call its `ngOnDestroy()` method to
unsubscribe from these events after each test.

In f69c6e204, a new testcase was introduced that was not destroyed. As a
result, random failures started to randomly happen in other, unrelated
tests ([example CI failure][1]).

This commit fixes this by ensuring all `ScrollService` instances are
destroyed after each tests (provided that they are created with the
`createScrollService()` helper).

[1]: https://circleci.com/gh/angular/angular/533298

PR Close #33937
2019-11-20 11:04:12 -08:00
bc97c25efe build: add ngJitMode to ng_rollup_bundle terser config (#33865)
This adds a `tools/ng_rollup_bundle/terser_config.json` file to override the default terser_minified config provided by the rule. After this change, the layer violation in rules_nodejs can be fixed by removing `"global_defs": {"ngDevMode": false, "ngI18nClosureMode": false},` from `terser_config.default.json` in rules_nodejs.

Change requested by Alex Rickabaugh in https://github.com/bazelbuild/rules_nodejs/pull/1338.

PR Close #33865
2019-11-20 10:29:46 -08:00
49571bf11a fix(core): make QueryList implement Iterable in the type system (#33536)
Originally, QueryList implemented Iterable and provided a Symbol.iterator
on its prototype. This caused issues with tree-shaking, so QueryList was
refactored and the Symbol.iterator added in its constructor instead. As
part of this change, QueryList no longer implemented Iterable directly.

Unfortunately, this meant that QueryList was no longer assignable to
Iterable or, consequently, NgIterable. NgIterable is used for NgFor's input,
so this meant that QueryList was not usable (in a type sense) for NgFor
iteration. View Engine's template type checking would not catch this, but
Ivy's did.

As a fix, this commit adds the declaration (but not the implementation) of
the Symbol.iterator function back to QueryList. This has no runtime effect,
so it doesn't affect tree-shaking of QueryList, but it ensures that
QueryList is assignable to NgIterable and thus usable with NgFor.

Fixes #29842

PR Close #33536
2019-11-19 13:43:53 -08:00
14156bd262 fix(ivy): emit fs-relative paths when rootDir(s) aren't in effect (#33828)
Previously, the compiler assumed that all TS files logically within a
project existed under one or more "root directories". If the TS compiler
option `rootDir` or `rootDirs` was set, they would dictate the root
directories in use, otherwise the current directory was used.

Unfortunately this assumption was unfounded - it's common for projects
without explicit `rootDirs` to import from files outside the current
working directory. In such cases the `LogicalProjectStrategy` would attempt
to generate imports into those files, and fail. This would lead to no
`ReferenceEmitStrategy` being able to generate an import, and end in a
compiler assertion failure.

This commit introduces a new strategy to use when there are no `rootDirs`
explicitly present, the `RelativePathStrategy`. It uses simpler, filesystem-
relative paths to generate imports, even to files above the current working
directory.

Fixes #33659
Fixes #33562

PR Close #33828
2019-11-19 12:41:24 -08:00
e42fa81aa9 test(ivy): support chdir() on the compiler's filesystem abstraction (#33828)
This commit adds the ability to change directories using the compiler's
internal filesystem abstraction. This is a prerequisite for writing tests
which are sensitive to the current working directory.

In addition to supporting the `chdir()` operation, this commit also fixes
`getDefaultLibLocation()` for mock filesystems to not assume `node_modules`
is in the current directory, but to resolve it similarly to how Node does
by progressively looking higher in the directory tree.

PR Close #33828
2019-11-19 12:41:24 -08:00
c7a3694eb9 fix(ivy): properly insert views before ng-container with injected ViewContainerRef (#33853)
PR Close #33853
2019-11-19 11:56:43 -08:00
839ac3c0a7 refactor(ivy): stricter TNode.inputs typing (#33798)
TNode.inputs are initialised during directives resolution now so we know early
if a node has directives with inputs or no. We don't need to use undefined value
as an indicator that inputs were not resolved yet.

PR Close #33798
2019-11-19 11:56:00 -08:00
105616cd2b perf(ivy): don't store public input names in two places (#33798)
Before this change a public name of a directive's input
was stored in 2 places:
- as a key of an object on TNode.index;
- as a value of PropertyAliasValue at the index 1

This PR changes the data structure so the public name is stored
only once as a key on TNode.index. This saves one array entry
for each and every directive input.

PR Close #33798
2019-11-19 11:56:00 -08:00
edd624b254 perf(ivy): add micro-benchmark focused on directive input update (#33798)
PR Close #33798
2019-11-19 11:56:00 -08:00
56801c74b9 fix(docs-infra): do not break when cookies are disabled in the browser (#33829)
Whenever cookies are disabled in the browser, `window.sessionStorage` is not avaialable to the app (i.e. even trying to access `window.sessionStorage` throws an error).

To avoid breaking the app, we use a no-op `Storage` implementation if `window.sessionStorage` is not available.

Fixes #33795

PR Close #33829
2019-11-19 11:42:11 -08:00
01af94ccd7 perf(ivy): extract template's instruction first create pass processing (#33856)
This refactorings clearly separates the first and subsequent creation execution
of the `template` instruction. This approach has the following benefits:
- it is clear what happens during the first vs. subsequent executions;
- we can avoid several memory reads and checks after the first creation pass
(there is measurable performance improvement on various benchmarks);
- the template instructions becomes smaller and should become a candidate
for optimisations / inlining faster;

PR Close #33856
2019-11-19 11:41:49 -08:00
456ea5cce4 refactor(ivy): limit reads from TView.consts (#33856)
PR Close #33856
2019-11-19 11:41:49 -08:00
1e78fafd37 docs: correct lifecycle hooks feature example (#33886)
PR Close #33886
2019-11-19 11:41:00 -08:00
83140f7926 build: ensure package-builder finds bazel (#33904)
Since `scripts/package-builder.js` gets run from the
`aio` folder sometimes, it is important to set the cwd
for the command that finds the bazel bin directory.

PR Close #33904
2019-11-19 11:40:19 -08:00
b08bb411b9 docs: add version requirement for routing option (#33909)
PR Close #33909
2019-11-19 11:40:03 -08:00
1b4d264ccf build: remove rules_nodejs legacy rollup_bundle patch (#33915)
We no longer depend on the legacy rollup_bundle rule so we don't require this patch

PR Close #33915
2019-11-19 11:39:49 -08:00
05d5c4fc76 fix(ngcc): properly detect origin of constructor param types (#33901)
The ReflectionHost supports enumeration of constructor parameters, and one
piece of information it returns describes the origin of the parameter's
type. Parameter types come in two flavors: local (the type is not imported
from anywhere) or non-local (the type comes via an import).

ngcc incorrectly classified all type parameters as 'local', because in the
source files that ngcc processes the type parameter is a real ts.Identifer.
However, that identifier may still have come from an import and thus might
be non-local.

This commit changes ngcc's ReflectionHost(s) to properly recognize and
report these non-local type references.

Fixes #33677

PR Close #33901
2019-11-19 11:38:33 -08:00
c126a6e3fc build: remove rollup-rule temp settings (#33908)
PR Close #33908
2019-11-18 16:02:25 -08:00
97ff04a7bd build: force RBE runs to use linux remote executors (#33902)
PR Close #33902
2019-11-18 16:02:11 -08:00
b744505620 refactor(ivy): separate first creation pass in the elementContainerStart instruction (#33894)
PR Close #33894
2019-11-18 16:01:55 -08:00
b707c48817 refactor(ivy): separate first creation pass in the text instruction (#33894)
PR Close #33894
2019-11-18 16:01:55 -08:00
2d7b015ed7 fix(bazel): add terser as an optional peer dependency (#33891)
`ng_package` rule has an implicitly optional depedency on terser a48573efe8/packages/bazel/src/ng_package/ng_package.bzl (L36)

When using this rule without terser being available we get the below error;
```
ERROR: /home/circleci/ng/modules/express-engine/BUILD.bazel:22:1: every rule of type ng_package implicitly depends upon the target '@npm//terser/bin:terser', but this target could not be found because of: no such package '@npm//terser/bin': BUILD file not found in directory 'terser/bin' of external repository @npm. Add a BUILD file to a directory to mark it as a package.
ERROR: Analysis of target '//modules/express-engine:npm_package' failed; build aborted: no such package '@npm//terser/bin': BUILD file not found in directory 'terser/bin' of external repository @npm. Add a BUILD file to a directory to mark it as a package.
```

PR Close #33891
2019-11-18 16:01:33 -08:00
b53a1ac999 fix(ivy): i18n - support "\", "`" and "${" sequences in i18n messages (#33820)
Since i18n messages are mapped to `$localize` tagged template strings,
the "raw" version must be properly escaped. Otherwise TS will throw an
error such as:

```
Error: Debug Failure. False expression: Expected argument 'text' to be the normalized (i.e. 'cooked') version of argument 'rawText'.
```

This commit ensures that we properly escape these raw strings before creating
TS AST nodes from them.

PR Close #33820
2019-11-18 16:00:23 -08:00
bc28ca7b0c fix(ivy): i18n - ensure that colons in i18n metadata are not rendered (#33820)
The `:` char is used as a metadata marker in `$localize` messages.
If this char appears in the metadata it must be escaped, as `\:`.
Previously, although the `:` char was being escaped, the TS AST
being generated was not correct and so it was being output double
escaped, which meant that it appeared in the rendered message.

As of TS 3.6.2 the "raw" string can be specified when creating tagged
template AST nodes, so it is possible to correct this.

PR Close #33820
2019-11-18 16:00:23 -08:00
b7c1a5e45f build: make ivy-i18n/debug-test.sh executable (#33820)
PR Close #33820
2019-11-18 16:00:22 -08:00
f136ddad0d fix(ivy): properly insert views into ViewContainerRef injected by querying <ng-container> (#33816)
When asking for a ViewContainerRef on <ng-container> we do reuse <ng-container> comment
node as a LContainer's anachor. Before this fix the act of re-using a <ng-container>'s
comment node would result in this comment node being re-appended to the DOM in the wrong
place. With the fix in this PR we make sure that re-using <ng-container>'s comment node
doesn't result in unwanted DOM manipulation (ng-gontainer's comment node is already part
of the DOM and doesn't have to be re-created / re-appended).

PR Close #33816
2019-11-18 16:00:01 -08:00
5be23a309e fix(ivy): shadow all DOM properties in DebugElement.properties (#33781)
Fixes #33695

PR Close #33781
2019-11-18 15:49:22 -08:00
6d06d9d3c6 refactor(compiler): add details while throw error during expression convert (#32760)
Fixes #32759

PR Close #32760
2019-11-18 15:47:59 -08:00
b7c012f91b feat(core): missing-injectable migration should migrate empty object literal providers (#33709)
In View Engine, providers which neither used `useValue`, `useClass`,
`useFactory` or `useExisting`, were interpreted differently.

e.g.

```
{provide: X} -> {provide: X, useValue: undefined}, // this is how it works in View Engine
{provide: X} -> {provide: X, useClass: X}, // this is how it works in Ivy
```

The missing-injectable migration should migrate such providers to the
explicit `useValue` provider. This ensures that there is no unexpected
behavioral change when updating to v9.

PR Close #33709
2019-11-18 15:47:20 -08:00
1b7aa05699 fix: fixes typo of zone.js patch vrdisplaydisconnected property (#33581)
Close #33579

PR Close #33581
2019-11-18 15:46:52 -08:00
1218ce4f5f docs: add xrefs to update app and deprecations policy (#33767)
PR Close #33767
2019-11-18 09:13:16 -08:00
7ffbe54ef0 docs: add html template for sizer component in template syntax guide (#33776)
fixes #33771

PR Close #33776
2019-11-18 09:12:46 -08:00
2f8c9e1990 build: update to fsevents@2.1.2 (#33866)
the previous version caused native compilation errors during postinstall on mac.

PR Close #33866
2019-11-18 09:12:30 -08:00
bde55ecc91 build: update to @bazel/buildifier@0.29.0 (#33866)
the previously used version was incompatible with the bazel vscode extension.

PR Close #33866
2019-11-18 09:12:30 -08:00
aeaf530de6 build: fix for ng_rollup_bundle outside of a sandbox (#33867)
Fixes issue introduced in https://github.com/angular/angular/pull/33808 for ng_rollup_bundle with `-spawn_strategy=standalone`. Without the sandbox (if --spawn_strategy=standalone is set) rollup can resolve to the non-esm .js file generated by ts_library instead of the desired .mjs. This fixes the problem by prioritizing .mjs.

Issue observed is of the flavor:

```
ERROR: modules/benchmarks/src/views/BUILD.bazel:20:1: Bundling JavaScript modules/benchmarks/src/views/bundle.es2015.js
[rollup] failed (Exit 1)
[!] Error: 'enableProdMode' is not exported by bazel-out/darwin-fastbuild/bin/packages/core/index.js
https://rollupjs.org/guide/en/#error-name-is-not-exported-by-module
bazel-out/darwin-fastbuild/bin/modules/benchmarks/src/views/index.mjs (12:9)
10:  * found in the LICENSE file at https://angular.io/license
11:  */
12: import { enableProdMode } from '@angular/core';
             ^
13: import { platformBrowser } from '@angular/platform-browser';
14: import { ViewsBenchmarkModuleNgFactory } from './views-benchmark.ngfactory';
Error: 'enableProdMode' is not exported by bazel-out/darwin-fastbuild/bin/packages/core/index.js
```

PR Close #33867
2019-11-18 09:12:18 -08:00
66ecab6e8c build(docs-infra): upgrade cli command docs sources to fbfcc45a3 (#33870)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](4deae92a3...fbfcc45a3):

**Modified**
- help/doc.json
- help/update.json

##

PR Close #33870
2019-11-18 09:12:02 -08:00
f3d8f6adca fix(ngcc): always add exports for ModuleWithProviders references (#33875)
In #32902 a bug was supposedly fixed where internal classes as used
within `ModuleWithProviders` are publicly exported, even when the
typings file already contained the generic type on the
`ModuleWithProviders`. This fix turns out to have been incomplete, as
the `ModuleWithProviders` analysis is not done when not processing the
typings files.

The effect of this bug is that formats that are processed after the
initial format had been processed would not have exports for internal
symbols, resulting in "export '...' was not found in '...'" errors.

This commit fixes the bug by always running the `ModuleWithProviders`
analyzer. An integration test has been added that would fail prior to
this change.

Fixes #33701

PR Close #33875
2019-11-18 09:11:34 -08:00
a05e42ad09 test(ngcc): expand integration tests with APF like package layouts (#33875)
ngcc has a basic integration test infrastructure that downlevels
TypeScript code into bundle formats that need to be processed by ngcc.
Until now, only ES5 bundles were created with a flat structure, however
more complex scenarios require an APF-like layout containing multiple
bundle formats.

PR Close #33875
2019-11-18 09:11:34 -08:00
0854dc8688 fix(ngcc): correctly include internal .d.ts files (#33875)
Some declaration files may not be referenced from an entry-point's
main typings file, as it may declare types that are only used internally.
ngcc has logic to include declaration files based on all source files,
to ensure internal declaration files are available.

For packages following APF layout, however, this logic was insufficient.
Consider an entry-point with base path of `/esm2015/testing` and typings
residing in `/testing`, the file
`/esm2015/testing/src/nested/internal.js` has its typings file at
`/testing/src/nested/internal.d.ts`. Previously, the declaration was
assumed to be located at `/esm2015/testing/testing/internal.d.ts` (by
means of `/esm2015/testing/src/nested/../../testing/internal.d.ts`)
which is not where the declaration file can be found. This commit
resolves the issue by looking in the correct directory.

PR Close #33875
2019-11-18 09:11:34 -08:00
5926b2897f docs(docs-infra): prevent auto-linking of snippet in guide (#33877)
By adding the `bash` language to the code snippet it will no
longer be auto-linked, which was causing a false positive link
to be rendered.

Fixes #33859

PR Close #33877
2019-11-18 09:11:01 -08:00
0405ddb521 fix(docs-infra): do not auto-link code in bash and json snippets (#33877)
Previously any code block, which was not marked with
`no-auto-link` css class would have its contents auto-linked to
API pages. Sometimes this results in false positive links being
generated.

This is problematic for triple backticked blocks, which cannot provide
the `no-auto-link` CSS class to prevent the linking.

This commit fixes the problem by allowing the auto-linker to be
configured not to auto-link code blocks that have been marked with an
"ignored" language. By default these are `bash` and `json`.

Triple backticked blocks are able to specify the language directly after
the first set of triple backticks.

Fixes #33859

PR Close #33877
2019-11-18 09:11:01 -08:00
1a9904d2f1 style(docs-infra): reformat the auto-link-code files (#33877)
PR Close #33877
2019-11-18 09:11:01 -08:00
37243ce680 build(docs-infra): sync examples node engine constraints with aio (#33877)
PR Close #33877
2019-11-18 09:11:01 -08:00
59a4b76b57 fix(ngcc): correctly associate decorators with aliased classes (#33878)
In flat bundle formats, multiple classes that have the same name can be
suffixed to become unique. In ES5-like bundles this results in the outer
declaration from having a different name from the "implementation"
declaration within the class' IIFE, as the implementation declaration
may not have been suffixed.

As an example, the following code would fail to have a `Directive`
decorator as ngcc would search for `__decorate` calls that refer to
`AliasedDirective$1` by name, whereas the `__decorate` call actually
uses the `AliasedDirective` name.

```javascript
var AliasedDirective$1 = /** @class */ (function () {
    function AliasedDirective() {}
    AliasedDirective = tslib_1.__decorate([
        Directive({ selector: '[someDirective]' }),
    ], AliasedDirective);
    return AliasedDirective;
}());
```

This commit fixes the problem by not relying on comparing names, but
instead finding the declaration and matching it with both the outer
and inner declaration.

PR Close #33878
2019-11-18 09:10:36 -08:00
80cd7d7a40 test(ngcc): avoid using spy in Esm2015ReflectionHost test (#33878)
A testcase that was using a spy has shown itself to be brittle, and its
assertions can easily be moved into a related test.

PR Close #33878
2019-11-18 09:10:36 -08:00
e47638ec7c build: replace fs methods with ShellJS' test('-d') (#33895)
This makes the JS script more similar to the original bash script it
replaced (see #33854) and will be easier to follow for people that are
less familiar with Node.js scripting.

Discussed in:
https://github.com/angular/angular/pull/33854#discussion_r346949765

PR Close #33895
2019-11-18 09:10:16 -08:00
7567f2b8c8 Revert "build: add ngJitMode to ng_rollup_bundle terser config (#33773)"
This reverts commit c89eed56b6.

Reason: fails on Windows CI
2019-11-15 16:21:13 -08:00
ebf3afb7f0 docs: updated dynamic forms example (#31510)
Fixes #31446

PR Close #31510
2019-11-15 16:16:45 -08:00
d562625960 build: fix typo in ng_rollup_bundle marco where es5 bundle were being passed to terser instead of es2015 bundle (#33808)
PR Close #33808
2019-11-15 16:15:13 -08:00
e57a8350e1 build: fix es2015 resolution issue in ng_rollup_bundle tool (#33808)
This fixes an issue bundling es2015 with ng_rollup_bundle that was covered up by a typo when refactoring ng_rollup_bundle to not use legacy rollup_bundle internals and to use the new terser_minified rule and npm_package_bin to call brotli.

Note: ng_rollup_bundle is only used in the angular repo and not externally so this issue does not affect users

PR Close #33808
2019-11-15 16:15:13 -08:00
dafdf9a87b docs(platform-webworker): mark all public APIs as deprecated (#33824)
In ccc76f749, `@angular/platform-webworker` and
`@angular/platform-webworker-dynamic` were deprecated (i.e. by
deprecating all their public APIs). However, some public
`@angular/platform-webworker` APIs were accidentally missed,
additionally resulting in the package itself not showing up as
deprecated on angular.io.

This commit fixes it by marking those remaining public APIs as
deprecated.

PR Close #33824
2019-11-15 16:14:37 -08:00
0e20453273 fix(language-service): Provide completions for attribute values (#33839)
This commit fixes a bug whereby completions for attribute values are only
provided for directives that support the micro-syntax format, all other
bindings are ignored.

I'm not sure if this is a regresssion or a bug, because there were no
tests prior to this.

PR Close #33839
2019-11-15 16:13:09 -08:00
5bfcd8231a build: fix build scripts on macOS (#33854)
In #33823, `scripts/package-builds.sh` (which is used by both
`build-packages-dist.sh` and `build-ivy-npm-packages.sh`) was updated to
use `realpath`. It turns out that `realpath` does not exist on macOS, so
the build scripts do not work there.

In order to fix this (and also reduce the likelihood of introducing
similar issues in the future), this commit changes these bash scripts to
Node.js scripts (using [ShellJS](https://github.com/shelljs/shelljs) for
a cross-platform implementation of Unix shell commands where necessary).

PR Close #33854
2019-11-15 16:05:00 -08:00
e641eaaae0 build: add ngJitMode to ng_rollup_bundle terser config (#33773)
This adds a `tools/ng_rollup_bundle/terser_config.json` file to override the default terser_minified config provided by the rule. After this change, the layer violation in rules_nodejs can be fixed by removing `"global_defs": {"ngDevMode": false, "ngI18nClosureMode": false},` from `terser_config.default.json` in rules_nodejs.

Change requested by Alex Rickabaugh in https://github.com/bazelbuild/rules_nodejs/pull/1338.

PR Close #33773
2019-11-15 15:58:00 -08:00
3074cdfea9 Revert "fix(router): make routerLinkActive work with query params which contain arrays (#22666)" (#33861)
This reverts commit b30bb8dd91.

Reason: breaks internal g3 project.

PR Close #33861
2019-11-15 13:14:43 -08:00
c182dea146 build: fix zone.js version stamping after updating to new rollup_bundle (#33329)
PR Close #33329
2019-11-15 10:50:14 -08:00
502fa906cd build: update zone.js to use the new rollup_bundle (#33329)
PR Close #33329
2019-11-15 10:50:14 -08:00
430293abe2 build: fixes for cross-platform RBE (#33708)
The earlier update to nodejs rules 0.40.0 fixes the cross-platform RBE issues with nodejs_binary. This commit adds a work-around for rules_webtesting cross-platform RBE issues.

PR Close #33708
2019-11-15 10:49:55 -08:00
cba6b7dd20 fix(ivy): ExpressionChangedAfterItHasBeenCheckedError for SafeValue (#33749)
Fix #33448

PR Close #33749
2019-11-15 10:44:23 -08:00
09480d3a9d fix(compiler-cli): Refactor getTsTypeFromBuiltinType (#33778)
This commit fixes a few issues with helper method
`getBuiltInTypeFromTsType`.

1. The function is wrongly named. It should be the other way round.
2. The ts.Type returned by the function should not contain any value.
This is because for some data types like Number and String, the
SourceFile (context.node) is not the correct value. Value is never
needed for program correctness in this case.

PR Close #33778
2019-11-15 10:43:41 -08:00
ca633535c5 fix(language-service): Function alias should be callable (#33782)
This commit fixes a long standing bug whereby a template variable that
gets initialized to a class method gets resolved to the Any type, thus
when it is called the language service produces error "Member X is not
callable".

PR closes https://github.com/angular/angular/issues/16643
PR closes https://github.com/angular/vscode-ng-language-service/issues/234

PR Close #33782
2019-11-15 10:43:18 -08:00
9761ebe7bd fix(ivy): support for #id bootstrap selectors (#33784)
Fixes: #33485

PR Close #33784
2019-11-15 10:42:53 -08:00
9882a8215a fix(language-service): Recompute analyzed modules only when source files change (#33806)
This commit fixes a bug brought up by @andrius-pra whereby the language
service host would recompute the analyzed modules even when none of the
source files changes. This is due to a bug in our unit test that
precludes non-TS files from incrementing the project version.
Consequently, when the external template is updated, the program remains
the same.

With the bug fixed, the next step is to figure out if any source files
have been added / changed / removed since the last computation. The
previously analyzed could be safely retained only when none of these
operations happen.

PR Close #33806
2019-11-15 10:42:09 -08:00
0688a28be3 fix(language-service): Remove getTemplateReferences() from LanguageService API (#33807)
The method `getTemplateReferences()` appears in both the LanguageService
interface and LanguageServiceHost interface. It should belong in the
latter and not the former, since the former deals with the semantics of
the language and not the mechanics.

PR Close #33807
2019-11-15 10:41:52 -08:00
af2cca0c7a refactor(ivy): Remove findComponentView since we now store it in LView[DECLARATION_COMPONENT_VIEW] (#33810)
PR Close #33810
2019-11-15 10:41:02 -08:00
4a4888b276 docs(ivy): improve the missing $localize error message (#33826)
If the application is not running directly in the browser, e.g.
universal or app-shell, then the `$localize` import must be
adding to a different file than for normal browser applications.

This commit adds more information about this to avoid any
confusion.

// FW-1557

PR Close #33826
2019-11-15 10:38:36 -08:00
d45bbccb58 build: update to terser 4.4.0 (#33835)
Now that terser_minified supports args as of nodejs rules 0.40.0, ng_rollup_bundle can updated to the pass —comments /a^/ to args can turn off all comments and maintain the current ng_rollup_bundle behavior with the latest version fo terser. //packages/core/test/bundling/todo:bundle.min.js size test passes with this fix.

Tho not strictly necessary to update terser, this will be a rough edge when someone does try it as it is not obvious why the //packages/core/test/bundling/todo:bundle.min.js size test fails. Updating now should save time in the future by not hitting this issue.\

This change also affect ng_package output as the default comments that are preserved by terser are now Comments with @preserve, @license, @cc_on as well as comments starting with /*! and /**! are now preserved by default.. (https://github.com/terser/terser/blob/master/CHANGELOG.md). Example ng_package golden file also updated as there are not some /*! comments preserved that were in older versions of terser.

PR Close #33835
2019-11-15 10:37:45 -08:00
d49c830064 build: fix build scripts on macOS (#33843)
In #33823, `scripts/package-builds.sh` (which is used by both
`build-packages-dist.sh` and `build-ivy-npm-packages.sh`) was updated to
use `realpath`. It turns out that `realpath` does not exist on macOS, so
the build scripts do not work there.

This commit fixes it by switching from `realpath $(pwd)/..` to
`dirname $(pwd)`, which does practically the same thing (in this
situation) and works on macOS as well.

PR Close #33843
2019-11-15 10:36:55 -08:00
12d67e0d31 docs: Hyperlink to HTML & CSS (#33844)
Link to have a reference on the HTML & CSS for basic understanding.

PR Close #33844
2019-11-15 10:36:18 -08:00
d39b643553 docs(changelog): mention CLDR update in breaking changes (#33848)
Angular `9.0.0-rc.2` contains an update of CLDR data to `v36.0.0`. The localized data changed for some locales, and this is breaking tests that are checking the result of i18n applications. For example, the space separator used in numbers changed from `\xa0` to `\u202f`.

This commit adds a mention to this change in the release notes, so developers can more easily understand why some of their tests are failing when updating to v9.

PR Close #33848
2019-11-15 10:34:37 -08:00
84524583e9 fix(ivy): extend assertion in directiveInject function to support IcuContainers (#33832)
Prior to this commit the assert that we have in `directiveInject` (assert introduced recently) didn't include IcuContainer TNode type and as a result, the error is thrown in case pipes with dependencies are used inside ICUs. This commit extends the assert to allow for IcuContainer TNode types.

PR Close #33832
2019-11-14 16:01:30 -08:00
a61fb76d51 fix(ivy): avoid cyclical dependency in imports (#33831)
This commit moves the `setLContainerActiveIndex` and `getLContainerActiveIndex` functions used in a few files to a common `util/view_util.ts` lib to avoid cyclical dependency while importing `instructions/container.ts` where these functions located originally.

PR Close #33831
2019-11-14 12:13:26 -08:00
b1d0a4f84d feat(bazel): update ng-add to use bazel v1.1.0 (#33813)
The ng-add schematic for `@angular/bazel` should set up
the latest Bazel version v1.1.0 that contains fixes for
windows. e.g. 618e5a28f7

PR Close #33813
2019-11-14 10:49:45 -08:00
63c3569e2a build: update bazel to v1.1.0 (#33813)
Updates Bazel to the latest stable version. Bazel 1.1.0
supposedly fixes a permission bug in Windows. Hence we
should try to update and see if that fixes the bug.

It's generally good to be up to date. See potential bug
fix commit:
618e5a28f7.

PR Close #33813
2019-11-14 10:49:44 -08:00
aaa38cf3f3 build: minor improvements to build script output (#33823)
- Move "Building packages" log above actual work (computing targets).
- Print corrent script name (`build-ivy-npm-packages.sh` would claim to
  be `build-packages-dist.sh`).
- Make logs of different operations a little more consistent.

PR Close #33823
2019-11-14 09:29:50 -08:00
a9d834fe69 refactor(compiler-cli): Move diagnostics files to language service (#33809)
The following files are consumed only by the language service and do not
have to be in compiler-cli:

1. expression_diagnostics.ts
2. expression_type.ts
3. typescript_symbols.ts
4. symbols.ts

PR Close #33809
2019-11-14 09:29:07 -08:00
987d2bd181 refactor(ivy): minor improvements / cleanup in the DI code (#33794)
PR Close #33794
2019-11-14 09:28:26 -08:00
a16a57e52a perf(ivy): Improve performance of transplanted views (#33702)
PR Close #33702
2019-11-14 09:27:58 -08:00
1860a9edbc feat(docs-infra): simplify image styles and remove figure references (#33748)
Reference #33259
Removes figures elements as AIO is not typically using captions or image groups where figures would be necessary or appropriate

PR Close #33748
2019-11-14 09:27:02 -08:00
5fd0d15d86 docs(common): fix condition in transformed *ngIf (#33425)
`<div class="hero-list" *ngIf="heroes else loading">` defines `heroes` as condition, but `hero-list` is used as condition in the transformed code `<ng-template [ngIf]="heroes" [ngIfElse]="loading">`.
PR Close #33425
2019-11-14 09:25:37 -08:00
8e5ed203bc fix(router): make routerLinkActive work with query params which contain arrays (#22666)
The url_tree equalQueryParams and containsQueryParam methods did not handle query params that has arrays, which resulted in the routerLinkActive to not behave as expected, change was made to ensure query params with arrays are handled correctly

fixes #22223

PR Close #22666
2019-11-13 13:51:35 -08:00
06e36e5972 fix(ngcc): do not emit ES2015 code in ES5 files (#33514)
Previously, ngcc's `Renderer` would add some constants in the processed
files which were emitted as ES2015 code (e.g. `const` declarations).
This would result in invalid ES5 generated code that would break when
run on browsers that do not support the emitted format.

This commit fixes it by adding a `printStatement()` method to
`RenderingFormatter`, which can convert statements to JavaScript code in
a suitable format for the corresponding `RenderingFormatter`.
Additionally, the `translateExpression()` and `translateStatement()`
ngtsc helper methods are augmented to accept an extra hint to know
whether the code needs to be translated to ES5 format or not.

Fixes #32665

PR Close #33514
2019-11-13 13:49:31 -08:00
21bd8c9a2e fix(ngcc): generate correct metadata for classes with getter/setter properties (#33514)
While processing class metadata, ngtsc generates a `setClassMetadata()`
call which (among other things) contains info about property decorators.
Previously, processing getter/setter pairs with some of ngcc's
`ReflectionHost`s resulted in multiple metadata entries for the same
property, which resulted in duplicate object keys, which in turn causes
an error in ES5 strict mode.

This commit fixes it by ensuring that there are no duplicate property
names in the `setClassMetadata()` calls.

In addition, `generateSetClassMetadataCall()` is updated to treat
`ClassMember#decorators: []` the same as `ClassMember.decorators: null`
(i.e. omitting the `ClassMember` from the generated `setClassMetadata()`
call). Alternatively, ngcc's `ReflectionHost`s could be updated to do
this transformation (`decorators: []` --> `decorators: null`) when
reflecting on class members, but this would require changes in many
places and be less future-proof.

For example, given a class such as:

```ts
class Foo {
  @Input() get bar() { return 'bar'; }
  set bar(value: any) {}
}
```

...previously the generated `setClassMetadata()` call would look like:

```ts
ɵsetClassMetadata(..., {
  bar: [{type: Input}],
  bar: [],
});
```

The same class will now result in a call like:

```ts
ɵsetClassMetadata(..., {
  bar: [{type: Input}],
});
```

Fixes #30569

PR Close #33514
2019-11-13 13:49:31 -08:00
1c1240c21a refactor(compiler-cli): avoid superfluous parenthesis around statements (#33514)
Previously, due to a bug a `Context` with `isStatement: false` could be
returned in places where a `Context` with `isStatement: true` was
requested. As a result, some statements would be unnecessarily wrapped
in parenthesis.

This commit fixes the bug in `Context#withStatementMode` to always
return a `Context` with the correct `isStatement` value. Note that this
does not have any impact on the generated code other than avoiding some
superfluous parenthesis on certain statements.

PR Close #33514
2019-11-13 13:49:31 -08:00
4c706086a7 docs(common): getCurrencySymbol return typo (#33792)
Extra 0 added to end of docs.
PR Close #33792
2019-11-13 13:37:11 -08:00
93ba4c2418 fix(ivy): constant object literals shared across element and component instances (#33705)
Currently if a consumer does something like the following, the object literal will be shared across the two elements and any instances of the component template. The same applies to array literals:

```
<div [someDirective]="{}"></div>
<div [someDirective]="{}"></div>
```

These changes make it so that we generate a pure function even if an object is constant so that each instance gets its own object.

Note that the original design for this fix included moving the pure function factories into the `consts` array. In the process of doing so I realized that pure function are also used inside of directive host bindings which means that we don't have access to the `consts`.

These changes also:
* Fix an issue that meant that the `pureFunction0` instruction could only be run during creation mode.
* Make the `getConstant` utility slightly more convenient to use. This isn't strictly required for these changes to work, but I had made it as a part of a larger refactor that I ended up reverting.

PR Close #33705
2019-11-13 13:36:41 -08:00
3f6d9a9870 build: ts_web_test & ts_web_test_suite deprecated in favor of karma_web_test & karma_web_test_suite (#33802)
This is a breaking change in nodejs rules 0.40.0 as part of the API review & cleanup for the 1.0 release. Their APIs are identical as ts_web_test was just karma_web_test without the config_file attribute.

PR Close #33802
2019-11-13 13:33:39 -08:00
ba4f171fac build: update to rules_nodejs 0.40.0 (#33802)
This release includes nodejs cross-platform RBE fix in https://github.com/bazelbuild/rules_nodejs/pull/1320 and adds `args` to terser_minified in https://github.com/bazelbuild/rules_nodejs/pull/1317. These changes are needed to land a few outstanding PRs.

* build: fixes for cross-platform RBE #33708
* build: update zone.js to use the new rollup_bundle #33329

fix: fix

PR Close #33802
2019-11-13 13:33:38 -08:00
744a3854f3 docs: add info on setting up VSCode remote development using docker containers (#33790)
In f78bda9ff, recommended configuration files were added to be used as
basis for setting up [Remote Development using docker containers][1] in
VSCode. Apparently, I had forgotten to commit the corresponding
`README.md` file.

This commit adds `.devcontainer/README.md` with more info on Remote
Development in VSCode.

[1]: https://code.visualstudio.com/docs/remote/containers

PR Close #33790
2019-11-13 13:33:22 -08:00
ac9fa2f2eb build: delete rxjs d.ts files referencing rxjs-compat (#33786)
In order to speed up bazel build performance delete all rxjs d.ts files
that reference rxjs-compat.

For all ts_library and ng_module rules Bazel generates tsconfig.json file
that explicitly lists all d.ts files found in required npm package.

In case of rxjs, this means that tsconfig contains all d.ts files that
reference rxjs-compat package, which is an interop/backwards compatibility
package not installed in angular/angular repo.

But because tsconfig contains these d.ts files, tsc will try to resolve
them and silently fail. All these lookups are quite expensive and not
cached. This causes significant slowdown of the build under bazel.

This change removes all of these problematic rxjs d.ts files via an npm
postinstall hook. This is not ideal because it solves the problem only
for our repo, but it's a good start.

Build perf improvements per target:
//packages/core/src/reflect:reflect    5sec =>  3 sec
//packages/core:core                  17sec => 12 sec
//packages/router:router              30sec =>  8 sec

PR Close #33786
2019-11-13 13:33:06 -08:00
de8cf75ff5 fix(ivy): reset style property value defined using [style.prop.px] (#33780)
Prior to this change, setting style prop value to undefined or empty string would not result in resetting prop value in case the style prop is defined using [style.prop.px] syntax. The problem is that the check for empty value (and thus reseting the value) considered successful only in case of `null` value. This commit updates the check to use `isStylingValueDefined` function that also checks for undefined and empty string.

PR Close #33780
2019-11-13 13:32:33 -08:00
5ad1e5f5ec release: cut the v9.0.0-rc.2 release 2019-11-13 12:49:34 -08:00
b4d7a684f8 build: set up all packages to publish via wombot proxy (#33747)
PR Close #33747
2019-11-13 11:34:33 -08:00
49e517d049 fix(ngcc): support minified ES5 scenarios (#33777)
The reflection hosts have been updated to support the following
code forms, which were found in some minified library code:

* The class IIFE not being wrapped in parentheses.
* Calls to `__decorate()` being combined with the IIFE return statement.

PR Close #33777
2019-11-13 11:11:49 -08:00
e1df98be17 fix(ngcc): remove __decorator calls even when part of the IIFE return statement (#33777)
Previously we only removed `__decorate()` calls that looked like:

```
SomeClass = __decorate(...);
```

But in some minified scenarios this call gets wrapped up with the
return statement of the IIFE.

```
return SomeClass = __decorate(...);
```

This is now removed also, leaving just the return statement:

```
return SomeClass;
```

PR Close #33777
2019-11-13 11:11:49 -08:00
1b489083bc refactor(ngcc): move stripParentheses to Esm5ReflectionHost for re-use (#33777)
PR Close #33777
2019-11-13 11:11:48 -08:00
9f10aa0d8c refactor(ngcc): remove unused function (#33777)
PR Close #33777
2019-11-13 11:11:48 -08:00
ecf38d48cf fix(ngcc): add default config for ng2-dragula (#33797)
The `dist/` directory has a duplicate `package.json` pointing to the
same files, which (under certain configurations) can causes ngcc to try
to process the files twice and fail.

This commit adds a default ngcc config for `ng2-dragula` to ignore the
`dist/` entry-point.

Fixes #33718

PR Close #33797
2019-11-13 11:09:59 -08:00
5f9a2d1cf8 docs: expand type-check info in update page (#33577)
PR Close #33577
2019-11-13 11:08:51 -08:00
8ed32e5e71 refactor(language-service): Colocate getAnalzyedModules and upToDate (#33779)
These two functions go hand-in-hand, putting them together improves
readability.

PR Close #33779
2019-11-12 21:34:53 -08:00
d67a38b7f5 fix(ivy): ComponentFactory.create should clear host element content (#33487)
Prior to this change, ComponentFactory.create function invocation in Ivy retained the content of the host element (in case host element reference or CSS seelctor is provided as an argument). This behavior is different in View Engine, where the content of the host element was cleared, except for the case when ShadowDom encapsulation is used (to make sure native slot projection works). This commit aligns Ivy and View Engine and makes sure the host element is cleared before component content insertion.

PR Close #33487
2019-11-12 21:34:07 -08:00
f750f187d5 docs: dix typo in DEVELOPER.md (#33743)
PR Close #33743
2019-11-12 16:08:44 -08:00
4e027fe3e4 test(ivy): view insertion before ng-container with a ViewContainerRef (#33755)
Closes #33679

PR Close #33755
2019-11-12 14:07:31 -08:00
1b0255c3b0 docs: remove migration-ngcc guide (#33727)
PR Close #33727
2019-11-12 14:03:49 -08:00
29852960c3 docs: add postinstall opt-in (#33727)
PR Close #33727
2019-11-12 14:03:48 -08:00
508bbfd92f fix(core): remove ngcc postinstall migration (#33727)
Partially address https://github.com/angular/angular-cli/issues/16017

PR Close #33727
2019-11-12 14:03:48 -08:00
e4cb91d373 style: Remove use of String as type and use string instead. (#33763)
PR Close #33763
2019-11-12 13:59:17 -08:00
71238a95d9 fix(ivy): ensure module scope is rebuild on dependent change (#33522)
During incremental compilations, ngtsc needs to know which metadata
from a previous compilation can be reused, versus which metadata has to
be recomputed as some dependency was updated. Changes to
directives/components should cause the NgModule in which they are
declared to be recompiled, as the NgModule's compilation is dependent
on its directives/components.

When a dependent source file of a directive/component is updated,
however, a more subtle dependency should also cause to NgModule's source
file to be invalidated. During the reconciliation of state from a
previous compilation into the new program, the component's source file
is invalidated because one of its dependency has changed, ergo the
NgModule needs to be invalidated as well. Up until now, this implicit
dependency was not imposed on the NgModule. Additionally, any change to
a dependent file may influence the module scope to change, so all
components within the module must be invalidated as well.

This commit fixes the bug by introducing additional file dependencies,
as to ensure a proper rebuild of the module scope and its components.

Fixes #32416

PR Close #33522
2019-11-12 13:56:31 -08:00
c22f15812c docs: expand configuration usage (#33229)
Followup to https://github.com/angular/angular-cli/pull/15819

PR Close #33229
2019-11-12 13:55:59 -08:00
da01dbc459 fix(ivy): recompile component when template changes in ngc watch mode (#33551)
When the Angular compiler is operated through the ngc binary in watch
mode, changing a template in an external file would not cause the
component to be recompiled if Ivy is enabled.

There was a problem with how a cached compiler host was present that was
unaware of the changed resources, therefore failing to trigger a
recompilation of a component whenever its template changes. This commit
fixes the issue by ensuring that information about modified resources is
correctly available to the cached compiler host.

Fixes #32869

PR Close #33551
2019-11-12 13:55:10 -08:00
37ae45e2ec fix(ivy): Run ChangeDetection on transplanted views (#33644)
https://hackmd.io/@mhevery/rJUJsvv9H

Closes #33393

PR Close #33644
2019-11-12 13:53:54 -08:00
4ec079f852 fix(core): support ngInjectableDef on types with inherited ɵprov (#33732)
The `ngInjectableDef` property was renamed to `ɵprov`, but core must
still support both because there are published libraries that use the
older term.

We are only interested in such properties that are defined directly on
the type being injected, not on base classes. So there is a check that
the defintion is specifically for the given type.

Previously if you tried to inject a class that had `ngInjectableDef` but
also inherited `ɵprov` then the check would fail on the `ɵprov` property
and never even try the `ngInjectableDef` property resulting in a failed
injection.

This commit fixes this by attempting to find each of the properties
independently.

Fixes https://github.com/angular/ngcc-validation/pull/526

PR Close #33732
2019-11-12 11:54:15 -08:00
b75a21294f build(common): generate correct "global" locale files (#33662)
PR Close #33662
2019-11-12 11:39:20 -08:00
faaa96c737 build(common): fix bad root reference in global locale files (#33662)
There was a mistake in the generation of the global
locale files, where `root` was being used instead of
the correctl `global`.

PR Close #33662
2019-11-12 11:39:20 -08:00
c315881d04 perf(core): Avoid unnecessary creating provider factory (#33742)
In providerToRecord move creating the factory into a condition which
actually needs it to avoid unnecessary creating it

PR Close #33742
2019-11-12 09:57:05 -08:00
bb9b8030d0 ci: publish tarballs for the zone.js package as CI build artifacts (#33733)
Since #33321, Angular packages have been persisted on each build as
CircleCI build artifacts (`.tgz` files), which can be used to install
dependencies on a project (for the purpose of testing or trying out a
change before a PR being merged and without having to build the packages
from source locally).

Previously, only packages published to npm under the `@angular` scope
were persisted as build artifacts.

This commit adds the `zone.js` package to the list of persisted
packages.

Fixes #33686

PR Close #33733
2019-11-12 09:55:18 -08:00
20e27a86d4 test(ngcc): build zone.js from source in scripts/build-packages-dist.sh (#33733)
In #33046, internal uses of `zone.js` were switched to reference it
directly from source (built with Bazel) instead of npm. As a result, the
necessary scripts were updated to build `zone.js` as necessary. However,
some `integration/**/debug-test.sh` scripts were missed (apparently
because they are not used on CI, but only locally as helpers for
debugging the integration projects).

This commit updates the `scripts/build-packages-dist.sh` script to also
build `zone.js`, so that other scripts (such as the various
`debug-test.sh` scripts) can use it.

PR Close #33733
2019-11-12 09:55:17 -08:00
7c4366dce8 revert: fix(ivy): R3TestBed should clean up registered modules after each test (#32872) (#33663)
This commit reverts 475e36a.

PR Close #33663
2019-11-12 09:53:16 -08:00
f8e9c1e6f1 revert: fix(ivy): Only restore registered modules if user compiles modules with TestBed (#32944) (#33663)
This commit reverts 63256b5.

PR Close #33663
2019-11-12 09:53:16 -08:00
4988094e7d fix(ivy): auto register NgModules with ID (#33663)
PR Close #33663
2019-11-12 09:53:16 -08:00
9ab49def61 docs: updated amexio resource description (#33645)
PR Close #33645
2019-11-12 09:52:49 -08:00
66157436f8 fix(language-service): Resolve template variable in nested ngFor (#33676)
This commit fixes a bug whereby template variables in nested scope are
not resolved properly and instead are simply typed as `any`.

PR closes https://github.com/angular/vscode-ng-language-service/issues/144

PR Close #33676
2019-11-11 16:06:00 -08:00
72796b98b1 fix: generate the new locale files (#33682)
PR Close #33682
2019-11-11 15:55:14 -08:00
ea83125df3 fix: use full cldr data to support all locales (#33682)
switching to cldr-data package resulted in
loss of some locales, since by default only core locales are loaded.
This PR adds a flag to tell cldr-data to use full locale coverage

fixes: #33681

PR Close #33682
2019-11-11 15:55:14 -08:00
83626962cf fix(ivy): ensure that the correct document is available (#33712)
Most of the use of `document` in the framework is within
the DI so they just inject the `DOCUMENT` token and are done.

Ivy is special because it does not rely upon the DI and must
get hold of the document some other way. There are a limited
number of places relevant to ivy that currently consume a global
document object.

The solution is modelled on the `LOCALE_ID` approach, which has
`getLocaleId()` and `setLocaleId()` top-level functions for ivy (see
`core/src/render3/i18n.ts`).  In the rest of Angular (i.e. using DI) the
`LOCALE_ID` token has a provider that also calls setLocaleId() to
ensure that ivy has the same value.

This commit defines `getDocument()` and `setDocument() `top-level
functions for ivy. Wherever ivy needs the global `document`, it calls
`getDocument()` instead.  Each of the platforms (e.g. Browser, Server,
WebWorker) have providers for `DOCUMENT`. In each of those providers
they also call `setDocument()` accordingly.

Fixes #33651

PR Close #33712
2019-11-11 14:01:05 -08:00
5b292bf125 test: rename mispelled sanitization_spec.ts file (#33712)
PR Close #33712
2019-11-11 14:01:04 -08:00
3160193719 test: cleanup document "after" each test (#33712)
It looks like there was a typo when it originally was
written. As it works right now, the `beforeEach` and
`afterEach` cancel each other out. But then
`ensureDocument()` is called anyway in the `withBody()`
function.

With this change there is no need to call `ensureDocument() in the
`withBody() function.

PR Close #33712
2019-11-11 14:01:04 -08:00
9045e3e495 fix: resolve event listeners not correct when registered outside of ngZone (#33711)
Close #33687.

PR Close #33711
2019-11-11 14:00:31 -08:00
c5400616f8 fix(ngcc): ensure that adjacent statements go after helper calls (#33689)
Previously the renderers were fixed so that they inserted extra
"adjacent" statements after the last static property of classes.

In order to help the build-optimizer (in Angular CLI) to be able to
tree-shake classes effectively, these statements should also appear
after any helper calls, such as `__decorate()`.

This commit moves the computation of this positioning into the
`NgccReflectionHost` via the `getEndOfClass()` method, which
returns the last statement that is related to the class.

FW-1668

PR Close #33689
2019-11-11 13:01:15 -08:00
f67802ddc0 refactor(ngcc): allow look up of multiple helpers (#33689)
This change is a precursor to finding the end of a
class, which needs to search for helpers of many
different names.

PR Close #33689
2019-11-11 13:01:15 -08:00
ffb010d3ab docs: fix numbering (#33736)
PR Close #33736
2019-11-11 12:46:34 -08:00
f45d5dc331 fix(ivy): provider override via TestBed should remove old providers from the list (#33706)
While overriding providers in Ivy TestBed (via TestBed.overrideProvider call), the old providers were retained in the list, since the override takes precedence. However, presence of providers in the list might have side-effect: if a provider has the `ngOnDestroy` lifecycle hook, this hook will be registered and invoked later (when component is destroyed). This commit updates TestBed logic to clear provider list by removing the ones which have overrides.

PR Close #33706
2019-11-11 12:46:16 -08:00
9396b19631 docs: update update guide to use ng update instead of npm i (#33726)
For more context see: https://github.com/angular/angular-cli/issues/16021

Closes: https://github.com/angular/angular-cli/issues/16021

PR Close #33726
2019-11-11 09:40:08 -08:00
343483cae0 build: add @angular/localize to ng-update packageGroup (#33721)
PR Close #33721
2019-11-11 09:39:43 -08:00
682eaef690 ci: update material-unit-tests job commit (#33716)
Updates the commit we run the `material-unit-tests` job
against. The latest commit includes 1255139a38

This commit reduces the flakiness of a `MatMenu` test and therefore
improves the stability of the material-unit-tests job.

Example failing build: https://circleci.com/gh/angular/angular/521625

PR Close #33716
2019-11-11 09:39:24 -08:00
011ecdf939 fix(common): rerun cldr to remove � characters (#33699)
PR Close #33699
2019-11-11 09:38:58 -08:00
cdceb60bd0 build: move clang formating out of gulp stream for cldr (#33699)
PR Close #33699
2019-11-11 09:38:58 -08:00
4613639a02 build(docs-infra): update @angular/* to 9.0.0-rc.1 (#33547)
PR Close #33547
2019-11-11 09:38:05 -08:00
f32ce01d93 build(docs-infra): update @angular/* to 9.0.0-rc.0 (#33547)
PR Close #33547
2019-11-11 09:38:05 -08:00
3d13a6d318 build(docs-infra): update @angular/cli to 9.0.0-rc.0 (#33547)
PR Close #33547
2019-11-11 09:38:04 -08:00
46b5e4ae69 build(docs-infra): update aio payload size (#33547)
PR Close #33547
2019-11-11 09:38:04 -08:00
e6f383fe20 test(ivy): get ViewRef.rootNodes should get all root nodes from projectable nodes (#33647)
PR Close #33647
2019-11-11 09:37:39 -08:00
86d656bc67 refactor(ivy): simplify getFirstNativeNode processing of LContainer (#33647)
PR Close #33647
2019-11-11 09:37:39 -08:00
c5737f4a19 fix(ivy): properly insert views in front of empty views (#33647)
PR Close #33647
2019-11-11 09:37:39 -08:00
0b998844c8 fix(ivy): properly insert views in front of views with an empty element container (#33647)
PR Close #33647
2019-11-11 09:37:39 -08:00
fc24a69a6b docs: add AOT mode default to version 9 upgrade doc (#33703)
PR Close #33703
2019-11-08 15:38:41 -08:00
b789c891bb docs: update jiali's info (#33698)
PR Close #33698
2019-11-08 14:41:16 -08:00
eb9ed8cc13 docs: grammar fix (#33170)
PR Close #33170
2019-11-08 14:40:58 -08:00
139b2e4f40 docs: add missing word (#33170)
PR Close #33170
2019-11-08 14:40:58 -08:00
290ae43db3 docs: fix migration-renderer code snippets (#33553)
Fix code snippets for migration-renderer.md found in next.angular.io
PR Close #33553
2019-11-08 12:43:21 -08:00
c7f913d1ec build(docs-infra): upgrade cli command docs sources to 4deae92a3 (#33684)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](7184f55eb...4deae92a3):

**Modified**
- help/update.json

##

PR Close #33684
2019-11-08 10:55:37 -08:00
ba68b560bc style: increase timeout to give blaze sufficient time to build (#33678)
PR Close #33678
2019-11-08 10:55:01 -08:00
69fdcbd71c docs: add ivy ssr opt-out (#33616)
PR Close #33616
2019-11-08 10:54:31 -08:00
a6ddda8834 docs: describe your change... (#32914)
Grammatical changes
PR Close #32914
2019-11-08 10:52:17 -08:00
2910d1a65f docs: update ivy compatibility guide with latest changes (#33675)
This commit removes one of the expected Ivy changes because we have
decided to change the behavior to be more backwards-compatible.

It also adds a bug fix that is technically breaking to the list of
expected changes.

PR Close #33675
2019-11-08 10:51:53 -08:00
811275cd15 fix(ivy): properly determine the first native node of a view (#33627)
PR Close #33627
2019-11-07 16:50:30 -08:00
c8c51a9879 test(ivy): tests for view insertion before another view (#33627)
PR Close #33627
2019-11-07 16:50:30 -08:00
33f6cd4799 fix(compiler-cli): Pass SourceFile to getFullText() (#33660)
Similar to https://github.com/angular/angular/pull/33633, this commit is
needed to fix an outage with the Angular Kythe indexer.

Crash logs:

```
TypeError: Cannot read property 'text' of undefined
    at NodeObject.getFullText (typescript/stable/lib/typescript.js:121443:57)
    at FactoryGenerator.generate (angular2/rc/packages/compiler-cli/src/ngtsc/shims/src/factory_generator.ts:67:34)
    at GeneratedShimsHostWrapper.getSourceFile (angular2/rc/packages/compiler-cli/src/ngtsc/shims/src/host.ts:88:26)
    at findSourceFile (typescript/stable/lib/typescript.js:90654:29)
    at typescript/stable/lib/typescript.js:90553:85
    at getSourceFileFromReferenceWorker (typescript/stable/lib/typescript.js:90520:34)
    at processSourceFile (typescript/stable/lib/typescript.js:90553:13)
    at processRootFile (typescript/stable/lib/typescript.js:90383:13)
    at typescript/stable/lib/typescript.js:89399:60
    at Object.forEach (typescript/stable/lib/typescript.js:280:30)

```

PR Close #33660
2019-11-07 16:47:08 -08:00
c1bd3bc76a fix(common): update CLDR generated files to 36.0.0 (#33584)
PR Close #33584
2019-11-07 22:11:34 +00:00
0248d6b8a7 build: update cldr-data package to 36.0.0 (#33584)
PR Close #33584
2019-11-07 22:11:33 +00:00
4f69ff7e85 test(ivy): introduce a benchmark for duplicate map-based style/class bindings (#33608)
Prior to this patch all the styling benchmarks only tested for
template map-based style/class bindings. Because of each of the bindings
being only present in the template, there was no possibility of
there being any duplicate map-based styling bindings.

This benchmark introduces benchmarking for map-based style/class bindings
that are evaluated from both template bindings as well as directives.

This benchmark can be executed by calling:

```
bazel build //packages/core/test/render3/perf:duplicate_map_based_style_and_class_bindings_lib.min_debug.es2015.js

node dist/bin/packages/core/test/render3/perf/duplicate_map_based_style_and_class_bindings_lib.min_debug.es2015.js
```

The benchmark is also run via the `profile_all.js` script (found in
`packages/core/test/render3/perf/`)

PR Close #33608
2019-11-07 20:34:26 +00:00
9df1178fe7 docs: app-name not rendering on browser (#33613)
Fixes #33612

PR Close #33613
2019-11-07 20:31:48 +00:00
76e52c5297 perf: report cold and minimal times when profiling in a browser (#33653)
PR Close #33653
2019-11-07 20:30:59 +00:00
83b635cb3f fix(ngcc): add reexports only once (#33658)
When ngcc is configured to generate reexports for a package using the
`generateDeepReexports` configuration option, it could incorrectly
render the reexports as often as the number of compiled classes in the
declaration file. This would cause compilation errors due to duplicated
declarations.

PR Close #33658
2019-11-07 20:29:13 +00:00
09cf0cd878 perf(ivy): allign (browser, benchpress, G3) the depth param for the tree benchmark (#33629)
PR Close #33629
2019-11-07 20:02:27 +00:00
cb55f60c74 revert: "fix(ivy): recompile component when template changes in ngc watch mode (#33551)" (#33661)
This reverts commit 8912b11f56.

PR Close #33661
2019-11-07 19:57:56 +00:00
cd8333cf0d fix(ivy): recompile component when template changes in ngc watch mode (#33551)
When the Angular compiler is operated through the ngc binary in watch
mode, changing a template in an external file would not cause the
component to be recompiled if Ivy is enabled.

There was a problem with how a cached compiler host was present that was
unaware of the changed resources, therefore failing to trigger a
recompilation of a component whenever its template changes. This commit
fixes the issue by ensuring that information about modified resources is
correctly available to the cached compiler host.

Fixes #32869

PR Close #33551
2019-11-07 17:52:59 +00:00
854a377232 test(ivy): introduce a benchmark for duplicate style/class bindings (#33600)
Prior to this patch all the styling benchmarks only tested for
template-based style/class bindings. Because of each of the bindings
being only present in the template, there was no possibility of
there being any duplicate bindings. This benchmark introduces
style/class bindings being evaluated from both a template and from
various directives.

This benchmark can be executed by calling:

```
bazel build //packages/core/test/render3/perf:duplicate_style_and_class_bindings_lib.min_debug.es2015.js

node dist/bin/packages/core/test/render3/perf/duplicate_style_and_class_bindings_lib.min_debug.es2015.js
```

The benchmark is also run via the `profile_all.js` script (found in
`packages/core/test/render3/perf/`)

PR Close #33600
2019-11-07 17:50:33 +00:00
8164d28b6c docs(changelog): Fixes typo in changelog (#33618)
Fixes typo in `NgFormSelectorWarning`. Was `NgFromSelectorWarning`
PR Close #33618
2019-11-07 17:49:56 +00:00
59b25da76b fix(common): update CLDR generated files after change to npm sources (#33634)
PR Close #33634
2019-11-07 17:49:20 +00:00
68380e4af2 build: move cldr dependency to npm (#33634)
PR Close #33634
2019-11-07 17:49:20 +00:00
4029c98f16 build(docs-infra): upgrade cli command docs sources to 7184f55eb (#33648)
Updating [angular#9.0.x](https://github.com/angular/angular/tree/9.0.x) from [cli-builds#9.0.x](https://github.com/angular/cli-builds/tree/9.0.x).

##
Relevant changes in [commit range](e598c8e89...7184f55eb):

**Modified**
- help/generate.json

##

PR Close #33648
2019-11-07 17:45:06 +00:00
99ead47bff fix(ivy): match directives on namespaced elements (#33555)
Prior to this change, namespaced elements such as SVG elements would not
participate correctly in directive matching as their namespace was not
ignored, which was the case with the View Engine compiler. This led to
incorrect behavior at runtime and template type checking.

This commit resolved the issue by ignoring the namespace of elements and
attributes like they were in View Engine.

Fixes #32061

PR Close #33555
2019-11-07 15:40:51 +00:00
d09ad82293 fix(ivy): Handle overrides for {providedIn: AModule} in R3TestBed (#33606)
This issue was found when debugging a test failure that was using lazy
loaded modules with the router. When doing this, the router calls
`NgModuleFactory.create` for the loaded module. This module gets a new
injector so the overrides provided in TestBed are not applied unless the
Injectable is in the providers list (which is not the case for
{providedIn...} Injectables).

PR Close #33606
2019-11-07 15:34:20 +00:00
4924d73b8e test(ivy): Have more descriptive names for LView (#33449)
When debugging `LView`s it is easy to get lost since all of them have
the same name. This change does three things:

1. It makes `TView` have an explicit type:
  - `Host`: for the top level `TView` for bootstrap
  - `Component`: for the `TView` which represents components template
  - `Embedded`: for the `TView` which represents an embedded template
2. It changes the name of `LView` to `LHostView`, `LComponentView`, and
  `LEmbeddedView` depending on the `TView` type.
3. For `LComponentView` and `LEmbeddedView` we also append the name of
  of the `context` constructor. The result is that we have `LView`s which
  are name as: `LComponentView_MyComponent` and `LEmbeddedView_NgIfContext`.

The above changes will make it easier to understand the structure of the
application when debugging.

NOTE: All of these are behind `ngDevMode` and will get removed in
production application.

PR Close #33449
2019-11-07 15:33:50 +00:00
7bccef516f fix(compiler-cli): Fix typo $implict (#33633)
Should be $implicit instead.

PR Close #33633
2019-11-07 01:54:17 +00:00
204620291e fix(ivy): better support for i18n attributes on <ng-container>s (#33599)
Prior to this commit, i18n runtime logic used `elementAttributeInternal` function (that uses `setAttribute` function under the hood) for all elements where i18n attributes are present. However the `<ng-container>` elements in a template may also have i18n attributes and calling `setAttribute` fails, since they are represented as comment nodes in DOM. This commit ensures that we call `setAttribute` on nodes with TNodeType.Element type (that support that operation) only.

PR Close #33599
2019-11-07 01:51:42 +00:00
3419b5002f style: Add VSCode recommended launch and task configurations (#33544)
This adds a common configurations used when developing code in VSCode.
Specifically it adds support for launching these targets as tasks and
ind debugger.

- `packages/core/test`
- `packages/core/test/render3`
- `packages/core/test/acceptance`

PR Close #33544
2019-11-07 01:04:41 +00:00
687582fd99 fix(compiler): correctly parse attributes with a dot in the name (#32256)
Previously the compiler would ignore everything in the attribute
name after the first dot. For example
<div [attr.someAttr.attrSuffix]="var"></div>
is turned into <div someAttr="varValue"></div>.

This commit ensures that whole attribute name is captured.
Now <div [attr.someAttr.attrSuffix]="var"></div>
is turned into <div someAttr.attrSuffix="varValue"></div>

PR Close #32256
2019-11-07 01:02:57 +00:00
1881 changed files with 38781 additions and 20840 deletions

View File

@ -6,4 +6,5 @@ aio/node_modules
aio/tools/examples/shared/node_modules
integration/bazel
integration/bazel-schematics/demo
integration/platform-server/node_modules
packages/bazel/node_modules

View File

@ -64,31 +64,12 @@ test --test_output=errors
################################
# Temporary Settings for Ivy #
################################
# to determine if the compiler used should be Ivy or ViewEngine one can use `--define=compile=aot` on
# any bazel target. This is a temporary flag until codebase is permanently switched to Ivy.
build --define=compile=legacy
# To determine if the compiler used should be Ivy instead of ViewEngine, one can use `--config=ivy`
# on any bazel target. This is a temporary flag until codebase is permanently switched to Ivy.
build --define=angular_ivy_enabled=False
################################
# Settings for rules_nodejs #
################################
# Temporary define while angular depends on the legacy rollup_bundle rule.
# TODO: remove this setting after https://github.com/angular/angular/pull/33201 lands.
build --define=enable_legacy_rollup_rule=1
#######################
# Remote HTTP Caching #
#######################
build --remote_http_cache=https://storage.googleapis.com/angular-team-cache
build --remote_accept_cached=true
build --remote_upload_local_results=false
######################################
# Remote HTTP Caching writes support #
# Turn on these settings with #
# --config=-http-caching #
######################################
build:remote-http-caching --remote_upload_local_results=true
build:remote-http-caching --google_default_credentials
build:view-engine --define=angular_ivy_enabled=False
build:ivy --define=angular_ivy_enabled=True
##################################
# Remote Build Execution support #
@ -108,6 +89,10 @@ build:remote --remote_timeout=600
build:remote --jobs=150
build:remote --google_default_credentials
# Force remote exeuctions to consider the entire run as linux
build:remote --cpu=k8
build:remote --host_cpu=k8
# Toolchain and platform related flags
build:remote --host_javabase=@rbe_ubuntu1604_angular//java:jdk
build:remote --javabase=@rbe_ubuntu1604_angular//java:jdk

View File

@ -11,4 +11,7 @@ import %workspace%/.circleci/bazel.common.rc
build --repository_cache=C:/Users/circleci/bazel_repository_cache
# All windows jobs run on master and should use http caching
build --config=remote-http-caching
build --remote_http_cache=https://storage.googleapis.com/angular-team-cache
build --remote_accept_cached=true
build --remote_upload_local_results=true
build --google_default_credentials

View File

@ -29,7 +29,7 @@ var_4_win: &cache_key_win_fallback v5-angular-win-node-12.0-
# Cache key for the Material unit tests job. **Note** when updating the SHA in the cache keys,
# also update the SHA for the "MATERIAL_REPO_COMMIT" environment variable.
var_5: &material_unit_tests_cache_key v5-angular-material-bc1c454391370e75cf604f94bc2e9131e9aef94e
var_5: &material_unit_tests_cache_key v5-angular-material-c1d898661b6055c67090f0cb8b7727b6335733b8
var_6: &material_unit_tests_cache_key_fallback v5-angular-material-
# Workspace initially persisted by the `setup` job, and then enhanced by `build-npm-packages` and
@ -365,7 +365,7 @@ jobs:
# Compile dependencies to ivy
# Running `ngcc` here (instead of implicitly via `ng build`) allows us to take advantage of
# the parallel, async mode speed-up (~20-25s on CI).
- run: yarn --cwd aio ivy-ngcc --properties es2015
- run: yarn --cwd aio ngcc --properties es2015
# Build aio
- run: yarn --cwd aio build --progress=false
# Lint the code
@ -502,13 +502,14 @@ jobs:
- setup_circleci_bazel_config
- setup_bazel_rbe
- run: scripts/build-packages-dist.sh
- run: node scripts/build-packages-dist.js
# Save the npm packages from //packages/... for other workflow jobs to read
- persist_to_workspace:
root: *workspace_location
paths:
- ng/dist/packages-dist
- ng/dist/zone.js-dist
# Save dependencies and bazel repository cache to use on subsequent runs.
- save_cache:
@ -529,7 +530,7 @@ jobs:
- setup_circleci_bazel_config
- setup_bazel_rbe
- run: scripts/build-ivy-npm-packages.sh
- run: node scripts/build-ivy-npm-packages.js
# Save the npm packages from //packages/... for other workflow jobs to read
- persist_to_workspace:
@ -569,15 +570,25 @@ jobs:
environment:
NG_PACKAGES_DIR: &ng_packages_dir 'dist/packages-dist'
NG_PACKAGES_ARCHIVES_DIR: &ng_packages_archives_dir 'dist/packages-dist-archives'
ZONEJS_PACKAGES_DIR: &zonejs_packages_dir 'dist/zone.js-dist'
ZONEJS_PACKAGES_ARCHIVES_DIR: &zonejs_packages_archives_dir 'dist/zone.js-dist-archives'
steps:
- custom_attach_workspace
- init_environment
# Publish `@angular/*` packages.
- run:
name: Create artifacts
command: ./scripts/ci/create-package-archives.sh $CI_PULL_REQUEST $CI_COMMIT $NG_PACKAGES_DIR $NG_PACKAGES_ARCHIVES_DIR
name: Create artifacts for @angular/* packages
command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $NG_PACKAGES_DIR $NG_PACKAGES_ARCHIVES_DIR
- store_artifacts:
path: *ng_packages_archives_dir
destination: angular
# Publish `zone.js` package.
- run:
name: Create artifacts for zone.js package
command: ./scripts/ci/create-package-archives.sh $CI_BRANCH $CI_COMMIT $ZONEJS_PACKAGES_DIR $ZONEJS_PACKAGES_ARCHIVES_DIR
- store_artifacts:
path: *zonejs_packages_archives_dir
destination: zone.js
# This job updates the content of repos like github.com/angular/core-builds
# for every green build on angular/angular.

View File

@ -55,21 +55,13 @@ setSecretVar CI_SECRET_PAYLOAD_FIREBASE_TOKEN "$ANGULAR_PAYLOAD_TOKEN";
####################################################################################################
# Define SauceLabs environment variables for CircleCI.
####################################################################################################
# In order to have a meaningful SauceLabs badge on the repo page,
# the angular2-ci account is used only when pushing commits to master;
# in all other cases, the regular angular-ci account is used.
if [ "${CI_PULL_REQUEST}" = "false" ] && [ "${CI_REPO_OWNER}" = "angular" ] && [ "${CI_BRANCH}" = "master" ]; then
setPublicVar SAUCE_USERNAME "angular2-ci";
setSecretVar SAUCE_ACCESS_KEY "693ebc16208a-0b5b-1614-8d66-a2662f4e";
else
setPublicVar SAUCE_USERNAME "angular-ci";
setSecretVar SAUCE_ACCESS_KEY "9b988f434ff8-fbca-8aa4-4ae3-35442987";
fi
setPublicVar SAUCE_USERNAME "angular-framework";
setSecretVar SAUCE_ACCESS_KEY "0c731274ed5f-cbc9-16f4-021a-9835e39f";
# TODO(josephperrott): Remove environment variables once all saucelabs tests are via bazel method.
setPublicVar SAUCE_LOG_FILE /tmp/angular/sauce-connect.log
setPublicVar SAUCE_READY_FILE /tmp/angular/sauce-connect-ready-file.lock
setPublicVar SAUCE_PID_FILE /tmp/angular/sauce-connect-pid-file.lock
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
setPublicVar SAUCE_TUNNEL_IDENTIFIER "angular-framework-${CIRCLE_BUILD_NUM}-${CIRCLE_NODE_INDEX}"
# Amount of seconds we wait for sauceconnect to establish a tunnel instance. In order to not
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout.
setPublicVar SAUCE_READY_FILE_TIMEOUT 120
@ -84,7 +76,7 @@ setPublicVar MATERIAL_REPO_TMP_DIR "/tmp/material2"
setPublicVar MATERIAL_REPO_URL "https://github.com/angular/material2.git"
setPublicVar MATERIAL_REPO_BRANCH "master"
# **NOTE**: When updating the commit SHA, also update the cache key in the CircleCI "config.yml".
setPublicVar MATERIAL_REPO_COMMIT "bc1c454391370e75cf604f94bc2e9131e9aef94e"
setPublicVar MATERIAL_REPO_COMMIT "c1d898661b6055c67090f0cb8b7727b6335733b8"
# Source `$BASH_ENV` to make the variables available immediately.
source $BASH_ENV;

31
.devcontainer/README.md Normal file
View File

@ -0,0 +1,31 @@
# VSCode Remote Development - Developing inside a Containers
This folder contains configuration files that can be used to opt into working on this repository in a [Docker container](https://www.docker.com/resources/what-container) via [VSCode](https://code.visualstudio.com/)'s Remote Development feature (see below).
Info on remote development and developing inside a container with VSCode:
- [VSCode: Remote Development](https://code.visualstudio.com/docs/remote/remote-overview)
- [VSCode: Developing inside a Container](https://code.visualstudio.com/docs/remote/containers)
- [VSCode: Remote Development FAQ](https://code.visualstudio.com/docs/remote/faq)
## Usage
_Prerequisite: [Install Docker](https://docs.docker.com/install) on your local environment._
To get started, read and follow the instuctions in [Developing inside a Container](https://code.visualstudio.com/docs/remote/containers). The [.devcontainer/](.) directory contains pre-configured `devcontainer.json` and `Dockerfile` files, which you can use to set up remote development with a docker container.
In a nutshell, you need to:
- Install the [Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) extension.
- Copy [recommended-Dockerfile](./recommended-Dockerfile) to `Dockerfile` (and optionally tweak to suit your needs).
- Copy [recommended-devcontainer.json](./recommended-devcontainer.json) to `devcontainer.json` (and optionally tweak to suit your needs).
- Open VSCode and bring up the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
- Type `Remote-Containers: Open Folder in Container` and choose your local clone of [angular/angular](https://github.com/angular/angular).
The `.devcontainer/devcontainer.json` and `.devcontainer/Dockerfile` files are ignored by git, so you can have your own local versions. We may occasionally update the template files ([recommended-devcontainer.json](./recommended-devcontainer.json), [recommended-Dockerfile](./recommended-Dockerfile)), in which case you will need to manually update your local copies (if desired).
## Updating `recommended-devcontainer.json` and `recommended-Dockerfile`
You can update and commit the recommended config files (which people use as basis for their local configs), if you find that something is broken, out-of-date or can be improved.
Please, keep in mind that any changes you make will potentially be used by many people on different environments. Try to keep these config files cross-platform compatible and free of personal preferences.

View File

@ -1,5 +1,5 @@
# Image metadata and config.
FROM circleci/node:10-browsers
FROM circleci/node:10-browsers # This needs to be in sync with what we use on CI.
LABEL name="Angular dev environment" \
description="This image can be used to create a dev environment for building Angular." \
@ -15,7 +15,7 @@ USER root
# Configure `Node.js`/`npm` and install utilities.
RUN npm config --global set user root
RUN npm install --global yarn@1.13.0 # This needs to be in sync with what we use on CI.
RUN npm install --global yarn@1.19.1 # This needs to be in sync with what we use on CI.
# Go! (And keep going.)

21
.github/CODEOWNERS vendored
View File

@ -50,6 +50,7 @@
# gkalpak - George Kalpakas
# IgorMinar - Igor Minar
# JiaLiPassion - Jia Li
# JoostK - Joost Koehoorn
# josephperrott - Joey Perrott
# kapunahelewong - Kapunahele Wong
# kara - Kara Erickson
@ -131,6 +132,9 @@
# ===========================================================
#
# - alxhub
# - AndrewKushnir
# - kara
# - JoostK
# ===========================================================
@ -344,6 +348,14 @@
# - josephperrott
# ===========================================================
# @angular/fw-size-tracking
# ===========================================================
#
# - IgorMinar
# - kara
######################################################################################################
@ -887,7 +899,6 @@ testing/** @angular/fw-test
/aio/content/guide/migration-injectable.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/migration-localize.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/migration-module-with-providers.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/migration-ngcc.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/updating-to-version-9.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ivy-compatibility.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
/aio/content/guide/ivy-compatibility-examples.md @angular/fw-docs-packaging @angular/framework-global-approvers @angular/framework-global-approvers-for-docs-only-changes
@ -946,6 +957,14 @@ testing/** @angular/fw-test
# ================================================
# Size tracking
# ================================================
/aio/scripts/_payload-limits.json @angular/fw-size-tracking
/integration/_payload-limits.json @angular/fw-size-tracking
# ================================================
# Special cases
# ================================================

2
.gitignore vendored
View File

@ -13,11 +13,13 @@ pubspec.lock
.c9
.idea/
.devcontainer/*
!.devcontainer/README.md
!.devcontainer/recommended-devcontainer.json
!.devcontainer/recommended-Dockerfile
.settings/
.vscode/launch.json
.vscode/settings.json
.vscode/tasks.json
*.swo
modules/.settings
modules/.vscode

18
.vscode/README.md vendored
View File

@ -1,23 +1,25 @@
# VSCode Configuration
This folder contains opt-in [Workspace Settings](https://code.visualstudio.com/docs/getstarted/settings) and [Extension Recommendations](https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions) that the Angular team recommends using when working on this repository.
This folder contains opt-in [Workspace Settings](https://code.visualstudio.com/docs/getstarted/settings), [Tasks](https://code.visualstudio.com/docs/editor/tasks), [Launch Configurations](https://code.visualstudio.com/Docs/editor/debugging#_launch-configurations) and [Extension Recommendations](https://code.visualstudio.com/docs/editor/extension-gallery#_workspace-recommended-extensions) that the Angular team recommends using when working on this repository.
## Usage
To use the recommended settings follow the steps below:
To use the recommended configurations follow the steps below:
- install <https://marketplace.visualstudio.com/items?itemName=xaver.clang-format>
- copy `.vscode/recommended-settings.json` to `.vscode/settings.json`
- install the recommneded extensions in `.vscode/extensions.json`
- copy (or link) `.vscode/recommended-settings.json` to `.vscode/settings.json`
- copy (or link) `.vscode/recommended-launch.json` to `.vscode/launch.json`
- copy (or link) `.vscode/recommended-tasks.json` to `.vscode/tasks.json`
- restart the editor
If you already have your custom workspace settings you should instead manually merge the file content.
If you already have your custom workspace settings you should instead manually merge the file contents.
This isn't an automatic process so you will need to repeat it when settings are updated.
To see the recommended extensions select "Extensions: Show Recommended Extensions" in the [Command Palette](https://code.visualstudio.com/docs/getstarted/userinterface#_command-palette).
## Editing `.vscode/recommended-settings.json`
## Editing `.vscode/recommended-*.json` files
If you wish to add extra configuration items please keep in mind any settings you add here will be used by many users.
If you wish to add extra configuration items please keep in mind any modifications you make here will be used by many users.
Try to keep these settings to things that help facilitate the development process and avoid altering the user workflow whenever possible.
Try to keep these settings/configuations to things that help facilitate the development process and avoid altering the user workflow whenever possible.

85
.vscode/recommended-launch.json vendored Normal file
View File

@ -0,0 +1,85 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Attach to bazel test ... --config=debug",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": true,
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"stopOnEntry": false,
"timeout": 600000,
},
{
"name": "Attach to bazel test ... --config=debug (no source maps)",
"type": "node",
"request": "attach",
"port": 9229,
"address": "localhost",
"restart": false,
"sourceMaps": false,
"localRoot": "${workspaceRoot}",
"remoteRoot": "${workspaceRoot}",
"stopOnEntry": false,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test/acceptance",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test/acceptance",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test/render3",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test/render3",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
{
"name": "IVY:packages/core/test",
"type": "node",
"request": "launch",
"program": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test",
"--config=debug"
],
"port": 9229,
"address": "localhost",
"restart": true,
"sourceMaps": true,
"timeout": 600000,
},
]
}

113
.vscode/recommended-tasks.json vendored Normal file
View File

@ -0,0 +1,113 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "IVY:packages/core/test/...",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test",
"packages/core/test/acceptance",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test/...",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"packages/core/test",
"packages/core/test/acceptance",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test/acceptance",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test/acceptance",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test/acceptance",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"packages/core/test/acceptance",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "VE:packages/core/test",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"packages/core/test",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
{
"label": "IVY:packages/core/test/render3",
"type": "shell",
"command": "${workspaceFolder}/node_modules/.bin/bazel",
"args": [
"test",
"--config=ivy",
"packages/core/test/render3",
],
"group": "test",
"presentation": {
"reveal": "always",
"panel": "dedicated",
},
},
],
}

View File

@ -1,3 +1,233 @@
<a name="9.0.0-rc.6"></a>
# [9.0.0-rc.6](https://github.com/angular/angular/compare/9.0.0-rc.5...9.0.0-rc.6) (2019-12-11)
### Bug Fixes
* **bazel:** improve performance of tsHost.writeFile() ([#34331](https://github.com/angular/angular/issues/34331)) ([d7c459a](https://github.com/angular/angular/commit/d7c459a))
* **common:** update closure locales to include directionality data ([#34240](https://github.com/angular/angular/issues/34240)) ([a02bde7](https://github.com/angular/angular/commit/a02bde7))
* **compiler:** ensure localized strings are ES5 compatible for JIT mode ([#34265](https://github.com/angular/angular/issues/34265)) ([26dba21](https://github.com/angular/angular/commit/26dba21)), closes [#34246](https://github.com/angular/angular/issues/34246)
* **compiler:** switch to modern diagnostic formatting ([#34234](https://github.com/angular/angular/issues/34234)) ([60051eb](https://github.com/angular/angular/commit/60051eb))
* **compiler-cli:** allow declaration-only template type check members ([#34296](https://github.com/angular/angular/issues/34296)) ([bbb9412](https://github.com/angular/angular/commit/bbb9412))
* **ivy:** add flag to skip non-exported classes ([#33921](https://github.com/angular/angular/issues/33921)) ([#34340](https://github.com/angular/angular/issues/34340)) ([7ed984b](https://github.com/angular/angular/commit/7ed984b)), closes [#33724](https://github.com/angular/angular/issues/33724)
* **ivy:** align TestBed.overrideProvider with what happens with providers in TestBed providers array ([#33769](https://github.com/angular/angular/issues/33769)) ([10a33ef](https://github.com/angular/angular/commit/10a33ef))
* **ivy:** do not invoke change detection for destroyed views ([#34241](https://github.com/angular/angular/issues/34241)) ([24bbcaf](https://github.com/angular/angular/commit/24bbcaf))
* **ivy:** handle SafeStyles in [style.prop] correctly ([#34286](https://github.com/angular/angular/issues/34286)) ([b0d5784](https://github.com/angular/angular/commit/b0d5784)), closes [/github.com/angular/angular/blob/master/packages/core/src/render3/styling/bindings.ts#L620](https://github.com//github.com/angular/angular/blob/master/packages/core/src/render3/styling/bindings.ts/issues/L620)
* **ivy:** inherit static coercion members from base classes ([#34296](https://github.com/angular/angular/issues/34296)) ([edfaab6](https://github.com/angular/angular/commit/edfaab6)), closes [#33830](https://github.com/angular/angular/issues/33830)
* **ivy:** properly parenthesize ternary expressions when emitted ([#34221](https://github.com/angular/angular/issues/34221)) ([af36bc6](https://github.com/angular/angular/commit/af36bc6)), closes [#34087](https://github.com/angular/angular/issues/34087)
* **ivy:** throw a better error when DI can't inject a ctor param ([#33739](https://github.com/angular/angular/issues/33739)) ([#34340](https://github.com/angular/angular/issues/34340)) ([676aca1](https://github.com/angular/angular/commit/676aca1)), closes [#33637](https://github.com/angular/angular/issues/33637)
* **language-service:** bug of accessing a string index signature using dot notation ([#34177](https://github.com/angular/angular/issues/34177)) ([72a5a8c](https://github.com/angular/angular/commit/72a5a8c))
* **language-service:** Remove getExternalFiles() ([#34260](https://github.com/angular/angular/issues/34260)) ([0e911f8](https://github.com/angular/angular/commit/0e911f8))
* **language-service:** return the js primitive type name ([#34177](https://github.com/angular/angular/issues/34177)) ([b4680a6](https://github.com/angular/angular/commit/b4680a6))
* **language-service:** Simplify resolution logic in banner ([#34262](https://github.com/angular/angular/issues/34262)) ([7dfd327](https://github.com/angular/angular/commit/7dfd327))
* **ngcc:** ensure that bundle `rootDir` is the package path ([#34212](https://github.com/angular/angular/issues/34212)) ([69dd516](https://github.com/angular/angular/commit/69dd516))
* **ngcc:** fix undecorated child migration when `exportAs` is present ([#34014](https://github.com/angular/angular/issues/34014)) ([24d1f9e](https://github.com/angular/angular/commit/24d1f9e))
* **ngcc:** log Angular error codes correctly ([#34014](https://github.com/angular/angular/issues/34014)) ([3cd43c1](https://github.com/angular/angular/commit/3cd43c1))
* **ngcc:** report diagnostics from migrations ([#34014](https://github.com/angular/angular/issues/34014)) ([599dcd0](https://github.com/angular/angular/commit/599dcd0))
### Performance Improvements
* **ivy:** chain listener instructions ([#33720](https://github.com/angular/angular/issues/33720)) ([#34340](https://github.com/angular/angular/issues/34340)) ([d3ec306](https://github.com/angular/angular/commit/d3ec306))
* **ivy:** chain styling instructions ([#33837](https://github.com/angular/angular/issues/33837)) ([#34340](https://github.com/angular/angular/issues/34340)) ([c66fd06](https://github.com/angular/angular/commit/c66fd06))
<a name="9.0.0-rc.5"></a>
# [9.0.0-rc.5](https://github.com/angular/angular/compare/9.0.0-rc.4...9.0.0-rc.5) (2019-12-04)
### Bug Fixes
* **bazel:** don't rely on [@angular](https://github.com/angular)/core being as a depedency to install [@angular](https://github.com/angular)/bazel ([#34181](https://github.com/angular/angular/issues/34181)) ([716fc84](https://github.com/angular/angular/commit/716fc84)), closes [#34164](https://github.com/angular/angular/issues/34164)
* **bazel:** reenable template type checking in ng_module ([#34144](https://github.com/angular/angular/issues/34144)) ([572e731](https://github.com/angular/angular/commit/572e731)), closes [/github.com/angular/angular/blob/168abc6d6f52713383411b14980e104c99bfeef5/packages/compiler-cli/src/ngtsc/program.ts#L430-L434](https://github.com//github.com/angular/angular/blob/168abc6d6f52713383411b14980e104c99bfeef5/packages/compiler-cli/src/ngtsc/program.ts/issues/L430-L434)
* **common:** reflect input type in NgForOf context ([#33997](https://github.com/angular/angular/issues/33997)) ([b640d38](https://github.com/angular/angular/commit/b640d38))
* **common:** reflect input type in NgIf context ([#33997](https://github.com/angular/angular/issues/33997)) ([7504543](https://github.com/angular/angular/commit/7504543)), closes [#31556](https://github.com/angular/angular/issues/31556)
* **compiler:** i18n - trim whitespace from i18n custom ids ([#34154](https://github.com/angular/angular/issues/34154)) ([64317c6](https://github.com/angular/angular/commit/64317c6)), closes [#34147](https://github.com/angular/angular/issues/34147)
* **compiler-cli:** ensure that `ngI18nClosureMode` is guarded in generated code ([#34211](https://github.com/angular/angular/issues/34211)) ([4d02556](https://github.com/angular/angular/commit/4d02556))
* **core:** ensure that `ngI18nClosureMode` is guarded ([#34211](https://github.com/angular/angular/issues/34211)) ([2546261](https://github.com/angular/angular/commit/2546261))
* **ivy:** allow insertion of views attached to a different container ([#34156](https://github.com/angular/angular/issues/34156)) ([65cd811](https://github.com/angular/angular/commit/65cd811)), closes [#34152](https://github.com/angular/angular/issues/34152)
* **ivy:** consistenly return -1 from ViewContainerRef.indexOf for non-inserted view ([#34156](https://github.com/angular/angular/issues/34156)) ([0044c66](https://github.com/angular/angular/commit/0044c66))
* **ivy:** correctly support `ngProjectAs` on templates ([#34200](https://github.com/angular/angular/issues/34200)) ([41ea3c2](https://github.com/angular/angular/commit/41ea3c2))
* **ivy:** i18n - correctly parse XLIFF placeholders ([#34155](https://github.com/angular/angular/issues/34155)) ([d5a48b2](https://github.com/angular/angular/commit/d5a48b2)), closes [#34151](https://github.com/angular/angular/issues/34151)
* **ivy:** i18n - trim whitespace when parsing metadata ([#34154](https://github.com/angular/angular/issues/34154)) ([f4d714c](https://github.com/angular/angular/commit/f4d714c))
* **ivy:** incorrectly validating html foreign objects inside svg ([#34178](https://github.com/angular/angular/issues/34178)) ([4836fe0](https://github.com/angular/angular/commit/4836fe0)), closes [#34171](https://github.com/angular/angular/issues/34171)
* **ivy:** support ICUs with pipes ([#34198](https://github.com/angular/angular/issues/34198)) ([eae541b](https://github.com/angular/angular/commit/eae541b))
* **language-service:** determine correct type for ngFor exported values ([#34089](https://github.com/angular/angular/issues/34089)) ([12e4aa0](https://github.com/angular/angular/commit/12e4aa0))
* **language-service:** Do not produce diagnostics if metadata for NgModule not found ([#34113](https://github.com/angular/angular/issues/34113)) ([29de8d3](https://github.com/angular/angular/commit/29de8d3))
* implement Symbol.specics of Promise ([#34162](https://github.com/angular/angular/issues/34162)) ([1bab8c2](https://github.com/angular/angular/commit/1bab8c2)), closes [#34105](https://github.com/angular/angular/issues/34105) [#33989](https://github.com/angular/angular/issues/33989)
* **language-service:** Insert parentheses for method completion ([#33860](https://github.com/angular/angular/issues/33860)) ([fb22f18](https://github.com/angular/angular/commit/fb22f18))
* **language-service:** Make missing module suggestion instead of error ([#34115](https://github.com/angular/angular/issues/34115)) ([#34193](https://github.com/angular/angular/issues/34193)) ([d2538ca](https://github.com/angular/angular/commit/d2538ca))
* **language-service:** use host.error() instead of console.error() ([#34114](https://github.com/angular/angular/issues/34114)) ([7a7e999](https://github.com/angular/angular/commit/7a7e999))
* **ngcc:** render legacy i18n message ids by default ([#34135](https://github.com/angular/angular/issues/34135)) ([93ac362](https://github.com/angular/angular/commit/93ac362)), closes [#34056](https://github.com/angular/angular/issues/34056)
### Performance Improvements
* add js-web-frameworks benchmark ([#34034](https://github.com/angular/angular/issues/34034)) ([bf16b0e](https://github.com/angular/angular/commit/bf16b0e))
* **ivy:** avoid duplicate state lookup and default function parameters ([#34183](https://github.com/angular/angular/issues/34183)) ([00f7372](https://github.com/angular/angular/commit/00f7372))
<a name="9.0.0-rc.4"></a>
# [9.0.0-rc.4](https://github.com/angular/angular/compare/9.0.0-rc.3...9.0.0-rc.4) (2019-11-27)
### Bug Fixes
* **bazel:** ng_module should not emit shim files under bazel and Ivy ([#33765](https://github.com/angular/angular/issues/33765)) ([e24ed8d](https://github.com/angular/angular/commit/e24ed8d))
* **bazel:** update to tsickle 0.37.1 to fix peerDep warnings ([#33788](https://github.com/angular/angular/issues/33788)) ([719ca1d](https://github.com/angular/angular/commit/719ca1d))
* **core:** allow css custom variables/properties in the style sanitizer ([#33841](https://github.com/angular/angular/issues/33841)) ([61cc7a3](https://github.com/angular/angular/commit/61cc7a3)), closes [#23485](https://github.com/angular/angular/issues/23485) [#23485](https://github.com/angular/angular/issues/23485)
* **core:** remove deprecated and defunct wtf* apis ([#33949](https://github.com/angular/angular/issues/33949)) ([cf42019](https://github.com/angular/angular/commit/cf42019))
* **ivy:** avoid infinite recursion when evaluation source files ([#33772](https://github.com/angular/angular/issues/33772)) ([b12fde4](https://github.com/angular/angular/commit/b12fde4)), closes [#33734](https://github.com/angular/angular/issues/33734)
* **ivy:** avoid using stale cache in TestBed if module overrides are defined ([#33787](https://github.com/angular/angular/issues/33787)) ([fbd2133](https://github.com/angular/angular/commit/fbd2133))
* **ivy:** handle non-standard input/output names in template type checking ([#33741](https://github.com/angular/angular/issues/33741)) ([94257ac](https://github.com/angular/angular/commit/94257ac)), closes [#33590](https://github.com/angular/angular/issues/33590)
* **ivy:** i18n - ensure that escaped chars are handled in localized strings ([#34065](https://github.com/angular/angular/issues/34065)) ([00f8d6a](https://github.com/angular/angular/commit/00f8d6a))
* **ivy:** prevent unknown element check for AOT-compiled components ([#34024](https://github.com/angular/angular/issues/34024)) ([955a312](https://github.com/angular/angular/commit/955a312))
* **ivy:** remove TNodeType assertion from `directiveInject` instruction ([#33948](https://github.com/angular/angular/issues/33948)) ([90a9043](https://github.com/angular/angular/commit/90a9043))
* **ivy:** reset style property using ngStyle fix ([#33920](https://github.com/angular/angular/issues/33920)) ([b8ba6b0](https://github.com/angular/angular/commit/b8ba6b0))
* **ivy:** run pre-order hooks in injection order ([#34026](https://github.com/angular/angular/issues/34026)) ([ebe3229](https://github.com/angular/angular/commit/ebe3229)), closes [#32522](https://github.com/angular/angular/issues/32522)
* **ivy:** support ICUs without "other" cases ([#34042](https://github.com/angular/angular/issues/34042)) ([781003f](https://github.com/angular/angular/commit/781003f))
* **ivy:** support inserting a `viewRef` that is already present ([#34052](https://github.com/angular/angular/issues/34052)) ([978b500](https://github.com/angular/angular/commit/978b500)), closes [#33924](https://github.com/angular/angular/issues/33924)
* **ivy:** take styles extracted from template into account in JIT mode ([#34017](https://github.com/angular/angular/issues/34017)) ([b659aa3](https://github.com/angular/angular/commit/b659aa3))
* **ivy:** track changes across failed builds ([#33971](https://github.com/angular/angular/issues/33971)) ([1ffbde1](https://github.com/angular/angular/commit/1ffbde1)), closes [#32214](https://github.com/angular/angular/issues/32214)
* **ivy:** wrap functions from "providers" in parentheses in Closure mode ([#33609](https://github.com/angular/angular/issues/33609)) ([fc6ad19](https://github.com/angular/angular/commit/fc6ad19)), closes [/github.com/angular/tsickle/blob/d7974262571c8a17d684e5ba07680e1b1993afdd/src/jsdoc_transformer.ts#L1021](https://github.com//github.com/angular/tsickle/blob/d7974262571c8a17d684e5ba07680e1b1993afdd/src/jsdoc_transformer.ts/issues/L1021)
* **language-service:** determine index types accessed using dot notation ([#33884](https://github.com/angular/angular/issues/33884)) ([e8ec296](https://github.com/angular/angular/commit/e8ec296)), closes [#29811](https://github.com/angular/angular/issues/29811) [#29811](https://github.com/angular/angular/issues/29811)
* **language-service:** fix error of array-index out of bounds exception ([#33928](https://github.com/angular/angular/issues/33928)) ([b05ce85](https://github.com/angular/angular/commit/b05ce85))
* **language-service:** function.bind() should not be an error ([#34041](https://github.com/angular/angular/issues/34041)) ([#34046](https://github.com/angular/angular/issues/34046)) ([d22f3d6](https://github.com/angular/angular/commit/d22f3d6))
* **ngcc:** do not crash on packages that specify typings as an array ([#33973](https://github.com/angular/angular/issues/33973)) ([e456e58](https://github.com/angular/angular/commit/e456e58)), closes [#33646](https://github.com/angular/angular/issues/33646)
* **ngcc:** do not output duplicate ɵprov properties ([#34085](https://github.com/angular/angular/issues/34085)) ([5a8d25d](https://github.com/angular/angular/commit/5a8d25d))
* **ngcc:** render localized strings when in ES5 format ([#33857](https://github.com/angular/angular/issues/33857)) ([c6695fa](https://github.com/angular/angular/commit/c6695fa))
* **ngcc:** render UMD global imports correctly ([#34012](https://github.com/angular/angular/issues/34012)) ([83989b8](https://github.com/angular/angular/commit/83989b8))
* **ngcc:** report errors from `analyze` and `resolve` processing ([#33964](https://github.com/angular/angular/issues/33964)) ([ca5d772](https://github.com/angular/angular/commit/ca5d772)), closes [/github.com/angular/angular/issues/33685#issuecomment-557091719](https://github.com//github.com/angular/angular/issues/33685/issues/issuecomment-557091719)
* **router:** make routerLinkActive work with query params which contain arrays ([#22666](https://github.com/angular/angular/issues/22666)) ([f1bf5b2](https://github.com/angular/angular/commit/f1bf5b2)), closes [#22223](https://github.com/angular/angular/issues/22223)
* **service-worker:** allow creating post api requests after cache failure ([#33930](https://github.com/angular/angular/issues/33930)) ([63c9123](https://github.com/angular/angular/commit/63c9123)), closes [#33793](https://github.com/angular/angular/issues/33793)
* **service-worker:** throw when using the unsupported `versionedFiles` option in config ([#33903](https://github.com/angular/angular/issues/33903)) ([250e6fd](https://github.com/angular/angular/commit/250e6fd))
### Features
* **language-service:** completions support for indexed types ([#34047](https://github.com/angular/angular/issues/34047)) ([8a565c8](https://github.com/angular/angular/commit/8a565c8)), closes [angular/vscode-ng-language-service#110](https://github.com/angular/vscode-ng-language-service/issues/110) [angular/vscode-ng-language-service#277](https://github.com/angular/vscode-ng-language-service/issues/277)
* **language-service:** completions support for tuple array ([#33928](https://github.com/angular/angular/issues/33928)) ([7faa9bb](https://github.com/angular/angular/commit/7faa9bb))
### Performance Improvements
* **ivy:** do no work if moving a `viewRef` to the same position ([#34052](https://github.com/angular/angular/issues/34052)) ([d228801](https://github.com/angular/angular/commit/d228801))
* **ivy:** fix creation time micro-benchmarks ([#34031](https://github.com/angular/angular/issues/34031)) ([457ac3a](https://github.com/angular/angular/commit/457ac3a))
* **ivy:** R3TestBed - Do not process NgModuleDefs that have already been processed ([#33863](https://github.com/angular/angular/issues/33863)) ([05a18cc](https://github.com/angular/angular/commit/05a18cc))
<a name="9.0.0-rc.3"></a>
# [9.0.0-rc.3](https://github.com/angular/angular/compare/9.0.0-rc.2...9.0.0-rc.3) (2019-11-20)
### Bug Fixes
* **bazel:** add terser as an optional peer dependency ([#33891](https://github.com/angular/angular/issues/33891)) ([2d7b015](https://github.com/angular/angular/commit/2d7b015))
* **compiler-cli:** Refactor getTsTypeFromBuiltinType ([#33778](https://github.com/angular/angular/issues/33778)) ([09480d3](https://github.com/angular/angular/commit/09480d3))
* **core:** make QueryList implement Iterable in the type system ([#33536](https://github.com/angular/angular/issues/33536)) ([49571bf](https://github.com/angular/angular/commit/49571bf)), closes [#29842](https://github.com/angular/angular/issues/29842)
* **ivy:** always re-analyze the program during incremental rebuilds ([#33862](https://github.com/angular/angular/issues/33862)) ([30ddadc](https://github.com/angular/angular/commit/30ddadc)), closes [#32388](https://github.com/angular/angular/issues/32388)
* **ivy:** avoid cyclical dependency in imports ([#33831](https://github.com/angular/angular/issues/33831)) ([a61fb76](https://github.com/angular/angular/commit/a61fb76))
* **ivy:** constant object literals shared across element and component instances ([#33705](https://github.com/angular/angular/issues/33705)) ([93ba4c2](https://github.com/angular/angular/commit/93ba4c2))
* **ivy:** don't infer template context types when in full mode ([#33537](https://github.com/angular/angular/issues/33537)) ([595375f](https://github.com/angular/angular/commit/595375f)), closes [#33527](https://github.com/angular/angular/issues/33527)
* **ivy:** emit fs-relative paths when rootDir(s) aren't in effect ([#33828](https://github.com/angular/angular/issues/33828)) ([14156bd](https://github.com/angular/angular/commit/14156bd)), closes [#33659](https://github.com/angular/angular/issues/33659) [#33562](https://github.com/angular/angular/issues/33562)
* **ivy:** ExpressionChangedAfterItHasBeenCheckedError for SafeValue ([#33749](https://github.com/angular/angular/issues/33749)) ([cba6b7d](https://github.com/angular/angular/commit/cba6b7d)), closes [#33448](https://github.com/angular/angular/issues/33448)
* **ivy:** extend assertion in `directiveInject` function to support IcuContainers ([#33832](https://github.com/angular/angular/issues/33832)) ([8452458](https://github.com/angular/angular/commit/8452458))
* **ivy:** i18n - ensure that colons in i18n metadata are not rendered ([#33820](https://github.com/angular/angular/issues/33820)) ([bc28ca7](https://github.com/angular/angular/commit/bc28ca7))
* **ivy:** i18n - support "\", "`" and "${" sequences in i18n messages ([#33820](https://github.com/angular/angular/issues/33820)) ([b53a1ac](https://github.com/angular/angular/commit/b53a1ac))
* **ivy:** move setClassMetadata calls into a pure iife ([#33337](https://github.com/angular/angular/issues/33337)) ([213e3c3](https://github.com/angular/angular/commit/213e3c3))
* **ivy:** properly insert views before ng-container with injected ViewContainerRef ([#33853](https://github.com/angular/angular/issues/33853)) ([c7a3694](https://github.com/angular/angular/commit/c7a3694))
* **ivy:** properly insert views into ViewContainerRef injected by querying <ng-container> ([#33816](https://github.com/angular/angular/issues/33816)) ([f136dda](https://github.com/angular/angular/commit/f136dda))
* **ivy:** report watch mode diagnostics correctly ([#33862](https://github.com/angular/angular/issues/33862)) ([d92da13](https://github.com/angular/angular/commit/d92da13)), closes [#32213](https://github.com/angular/angular/issues/32213)
* **ivy:** reset style property value defined using [style.prop.px] ([#33780](https://github.com/angular/angular/issues/33780)) ([de8cf75](https://github.com/angular/angular/commit/de8cf75))
* **ivy:** retain JIT metadata unless JIT mode is explicitly disabled ([#33671](https://github.com/angular/angular/issues/33671)) ([5267c92](https://github.com/angular/angular/commit/5267c92))
* **ivy:** shadow all DOM properties in `DebugElement.properties` ([#33781](https://github.com/angular/angular/issues/33781)) ([5be23a3](https://github.com/angular/angular/commit/5be23a3)), closes [#33695](https://github.com/angular/angular/issues/33695)
* **ivy:** support for #id bootstrap selectors ([#33784](https://github.com/angular/angular/issues/33784)) ([9761ebe](https://github.com/angular/angular/commit/9761ebe)), closes [#33485](https://github.com/angular/angular/issues/33485)
* **language-service:** Function alias should be callable ([#33782](https://github.com/angular/angular/issues/33782)) ([ca63353](https://github.com/angular/angular/commit/ca63353))
* **language-service:** Provide completions for attribute values ([#33839](https://github.com/angular/angular/issues/33839)) ([0e20453](https://github.com/angular/angular/commit/0e20453))
* **language-service:** Recompute analyzed modules only when source files change ([#33806](https://github.com/angular/angular/issues/33806)) ([9882a82](https://github.com/angular/angular/commit/9882a82))
* **language-service:** Remove getTemplateReferences() from LanguageService API ([#33807](https://github.com/angular/angular/issues/33807)) ([0688a28](https://github.com/angular/angular/commit/0688a28))
* **ngcc:** always add exports for `ModuleWithProviders` references ([#33875](https://github.com/angular/angular/issues/33875)) ([f3d8f6a](https://github.com/angular/angular/commit/f3d8f6a)), closes [#33701](https://github.com/angular/angular/issues/33701)
* **ngcc:** correctly associate decorators with aliased classes ([#33878](https://github.com/angular/angular/issues/33878)) ([59a4b76](https://github.com/angular/angular/commit/59a4b76))
* **ngcc:** correctly include internal .d.ts files ([#33875](https://github.com/angular/angular/issues/33875)) ([0854dc8](https://github.com/angular/angular/commit/0854dc8))
* **ngcc:** do not emit ES2015 code in ES5 files ([#33514](https://github.com/angular/angular/issues/33514)) ([06e36e5](https://github.com/angular/angular/commit/06e36e5)), closes [#32665](https://github.com/angular/angular/issues/32665)
* **ngcc:** generate correct metadata for classes with getter/setter properties ([#33514](https://github.com/angular/angular/issues/33514)) ([21bd8c9](https://github.com/angular/angular/commit/21bd8c9)), closes [#30569](https://github.com/angular/angular/issues/30569)
* **ngcc:** properly detect origin of constructor param types ([#33901](https://github.com/angular/angular/issues/33901)) ([05d5c4f](https://github.com/angular/angular/commit/05d5c4f)), closes [#33677](https://github.com/angular/angular/issues/33677)
* **router:** make routerLinkActive work with query params which contain arrays ([#22666](https://github.com/angular/angular/issues/22666)) ([8e5ed20](https://github.com/angular/angular/commit/8e5ed20)), closes [#22223](https://github.com/angular/angular/issues/22223)
* **zone.js:** fixes typo of zone.js patch vrdisplaydisconnected property ([#33581](https://github.com/angular/angular/issues/33581)) ([1b7aa05](https://github.com/angular/angular/commit/1b7aa05)), closes [#33579](https://github.com/angular/angular/issues/33579)
### Features
* **bazel:** update ng-add to use bazel v1.1.0 ([#33813](https://github.com/angular/angular/issues/33813)) ([b1d0a4f](https://github.com/angular/angular/commit/b1d0a4f))
* **core:** missing-injectable migration should migrate empty object literal providers ([#33709](https://github.com/angular/angular/issues/33709)) ([b7c012f](https://github.com/angular/angular/commit/b7c012f))
### Performance Improvements
* **ivy:** add micro-benchmark focused on directive input update ([#33798](https://github.com/angular/angular/issues/33798)) ([edd624b](https://github.com/angular/angular/commit/edd624b))
* **ivy:** don't store public input names in two places ([#33798](https://github.com/angular/angular/issues/33798)) ([105616c](https://github.com/angular/angular/commit/105616c))
* **ivy:** extract template's instruction first create pass processing ([#33856](https://github.com/angular/angular/issues/33856)) ([01af94c](https://github.com/angular/angular/commit/01af94c))
* **ivy:** Improve performance of transplanted views ([#33702](https://github.com/angular/angular/issues/33702)) ([a16a57e](https://github.com/angular/angular/commit/a16a57e))
<a name="9.0.0-rc.2"></a>
# [9.0.0-rc.2](https://github.com/angular/angular/compare/9.0.0-rc.1...9.0.0-rc.2) (2019-11-13)
### Bug Fixes
* **common:** rerun cldr to remove <20> characters ([#33699](https://github.com/angular/angular/issues/33699)) ([011ecdf](https://github.com/angular/angular/commit/011ecdf))
* **common:** update CLDR generated files after change to npm sources ([#33634](https://github.com/angular/angular/issues/33634)) ([59b25da](https://github.com/angular/angular/commit/59b25da))
* **common:** update CLDR generated files to 36.0.0 ([#33584](https://github.com/angular/angular/issues/33584)) ([c1bd3bc](https://github.com/angular/angular/commit/c1bd3bc))
* **compiler:** correctly parse attributes with a dot in the name ([#32256](https://github.com/angular/angular/issues/32256)) ([687582f](https://github.com/angular/angular/commit/687582f))
* **compiler-cli:** Fix typo $implict ([#33633](https://github.com/angular/angular/issues/33633)) ([7bccef5](https://github.com/angular/angular/commit/7bccef5))
* **compiler-cli:** Pass SourceFile to getFullText() ([#33660](https://github.com/angular/angular/issues/33660)) ([33f6cd4](https://github.com/angular/angular/commit/33f6cd4))
* **core:** remove ngcc postinstall migration ([#33727](https://github.com/angular/angular/issues/33727)) ([508bbfd](https://github.com/angular/angular/commit/508bbfd))
* **core:** support `ngInjectableDef` on types with inherited `ɵprov` ([#33732](https://github.com/angular/angular/issues/33732)) ([4ec079f](https://github.com/angular/angular/commit/4ec079f))
* **ivy:** auto register NgModules with ID ([#33663](https://github.com/angular/angular/issues/33663)) ([4988094](https://github.com/angular/angular/commit/4988094))
* **ivy:** better support for i18n attributes on <ng-container>s ([#33599](https://github.com/angular/angular/issues/33599)) ([2046202](https://github.com/angular/angular/commit/2046202))
* **ivy:** ComponentFactory.create should clear host element content ([#33487](https://github.com/angular/angular/issues/33487)) ([d67a38b](https://github.com/angular/angular/commit/d67a38b))
* **ivy:** ensure module scope is rebuilt on dependent change ([#33522](https://github.com/angular/angular/issues/33522)) ([71238a9](https://github.com/angular/angular/commit/71238a9)), closes [#32416](https://github.com/angular/angular/issues/32416)
* **ivy:** ensure that the correct `document` is available ([#33712](https://github.com/angular/angular/issues/33712)) ([8362696](https://github.com/angular/angular/commit/8362696)), closes [#33651](https://github.com/angular/angular/issues/33651)
* **ivy:** Handle overrides for {providedIn: AModule} in R3TestBed ([#33606](https://github.com/angular/angular/issues/33606)) ([d09ad82](https://github.com/angular/angular/commit/d09ad82))
* **ivy:** match directives on namespaced elements ([#33555](https://github.com/angular/angular/issues/33555)) ([99ead47](https://github.com/angular/angular/commit/99ead47)), closes [#32061](https://github.com/angular/angular/issues/32061)
* **ivy:** properly determine the first native node of a view ([#33627](https://github.com/angular/angular/issues/33627)) ([811275c](https://github.com/angular/angular/commit/811275c))
* **ivy:** properly insert views in front of empty views ([#33647](https://github.com/angular/angular/issues/33647)) ([c5737f4](https://github.com/angular/angular/commit/c5737f4))
* **ivy:** properly insert views in front of views with an empty element container ([#33647](https://github.com/angular/angular/issues/33647)) ([0b99884](https://github.com/angular/angular/commit/0b99884))
* **ivy:** provider override via TestBed should remove old providers from the list ([#33706](https://github.com/angular/angular/issues/33706)) ([f45d5dc](https://github.com/angular/angular/commit/f45d5dc))
* **ivy:** recompile component when template changes in ngc watch mode ([#33551](https://github.com/angular/angular/issues/33551)) ([da01dbc](https://github.com/angular/angular/commit/da01dbc)), closes [#32869](https://github.com/angular/angular/issues/32869)
* **ivy:** recompile component when template changes in ngc watch mode ([#33551](https://github.com/angular/angular/issues/33551)) ([cd8333c](https://github.com/angular/angular/commit/cd8333c)), closes [#32869](https://github.com/angular/angular/issues/32869)
* **ivy:** Run ChangeDetection on transplanted views ([#33644](https://github.com/angular/angular/issues/33644)) ([37ae45e](https://github.com/angular/angular/commit/37ae45e)), closes [#33393](https://github.com/angular/angular/issues/33393)
* **language-service:** Resolve template variable in nested ngFor ([#33676](https://github.com/angular/angular/issues/33676)) ([6615743](https://github.com/angular/angular/commit/6615743))
* **ngcc:** add default config for `ng2-dragula` ([#33797](https://github.com/angular/angular/issues/33797)) ([ecf38d4](https://github.com/angular/angular/commit/ecf38d4)), closes [#33718](https://github.com/angular/angular/issues/33718)
* **ngcc:** add reexports only once ([#33658](https://github.com/angular/angular/issues/33658)) ([83b635c](https://github.com/angular/angular/commit/83b635c))
* **ngcc:** ensure that adjacent statements go after helper calls ([#33689](https://github.com/angular/angular/issues/33689)) ([c540061](https://github.com/angular/angular/commit/c540061))
* generate the new locale files ([#33682](https://github.com/angular/angular/issues/33682)) ([72796b9](https://github.com/angular/angular/commit/72796b9))
* resolve event listeners not correct when registered outside of ngZone ([#33711](https://github.com/angular/angular/issues/33711)) ([9045e3e](https://github.com/angular/angular/commit/9045e3e)), closes [#33687](https://github.com/angular/angular/issues/33687)
* use full cldr data to support all locales ([#33682](https://github.com/angular/angular/issues/33682)) ([ea83125](https://github.com/angular/angular/commit/ea83125)), closes [#33681](https://github.com/angular/angular/issues/33681)
* **ngcc:** remove `__decorator` calls even when part of the IIFE return statement ([#33777](https://github.com/angular/angular/issues/33777)) ([e1df98b](https://github.com/angular/angular/commit/e1df98b))
* **ngcc:** support minified ES5 scenarios ([#33777](https://github.com/angular/angular/issues/33777)) ([49e517d](https://github.com/angular/angular/commit/49e517d))
### Performance Improvements
* **core:** Avoid unnecessary creating provider factory ([#33742](https://github.com/angular/angular/issues/33742)) ([c315881](https://github.com/angular/angular/commit/c315881))
### Reverts
* "fix(ivy): recompile component when template changes in ngc watch mode ([#33551](https://github.com/angular/angular/issues/33551))" ([#33661](https://github.com/angular/angular/issues/33661)) ([cb55f60](https://github.com/angular/angular/commit/cb55f60))
* fix(ivy): Only restore registered modules if user compiles modules with TestBed ([#32944](https://github.com/angular/angular/issues/32944)) ([#33663](https://github.com/angular/angular/issues/33663)) ([f8e9c1e](https://github.com/angular/angular/commit/f8e9c1e))
* fix(ivy): R3TestBed should clean up registered modules after each test ([#32872](https://github.com/angular/angular/issues/32872)) ([#33663](https://github.com/angular/angular/issues/33663)) ([7c4366d](https://github.com/angular/angular/commit/7c4366d))
### BREAKING CHANGES
* **i18n:** The CLDR data has been updated to v36.0.0, which may cause some localized data strings to change. For example, the space separator used in numbers in the `fr` locales changed from `\xa0` to `\u202f` ([c1bd3bc](https://github.com/angular/angular/commit/c1bd3bc))
<a name="9.0.0-rc.1"></a>
# [9.0.0-rc.1](https://github.com/angular/angular/compare/9.0.0-rc.0...9.0.0-rc.1) (2019-11-06)
@ -298,7 +528,7 @@ or
npm install tslib --save
```
* **forms:** * `<ngForm></ngForm>` can no longer be used as a selector. Use `<ng-form></ng-form>` instead.
* The `NgFromSelectorWarning` directive has been removed.
* The `NgFormSelectorWarning` directive has been removed.
* `FormsModule.withConfig` has been removed. Use the `FormsModule` directly.

View File

@ -5,24 +5,11 @@ workspace(
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
# Uncomment for local bazel rules development
#local_repository(
# name = "build_bazel_rules_nodejs",
# path = "../rules_nodejs",
#)
#local_repository(
# name = "npm_bazel_typescript",
# path = "../rules_typescript",
#)
# Fetch rules_nodejs so we can install our npm dependencies
http_archive(
name = "build_bazel_rules_nodejs",
patch_args = ["-p1"],
# Patch https://github.com/bazelbuild/rules_nodejs/pull/903
patches = ["//tools:rollup_bundle_commonjs_ignoreGlobal.patch"],
sha256 = "3d7296d834208792fa3b2ded8ec04e75068e3de172fae79db217615bd75a6ff7",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.39.1/rules_nodejs-0.39.1.tar.gz"],
sha256 = "16fc00ab0d1e538e88f084272316c0693a2e9007d64f45529b82f6230aedb073",
urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/0.42.2/rules_nodejs-0.42.2.tar.gz"],
)
# Check the bazel version and download npm dependencies
@ -39,25 +26,10 @@ Try running `yarn bazel` instead.
(If you did run that, check that you've got a fresh `yarn install`)
""",
minimum_bazel_version = "0.27.0",
minimum_bazel_version = "1.1.0",
)
# The NodeJS rules version must be at least the following version because:
# - 0.15.2 Re-introduced the prod_only attribute on yarn_install
# - 0.15.3 Includes a fix for the `jasmine_node_test` rule ignoring target tags
# - 0.16.8 Supports npm installed bazel workspaces
# - 0.26.0 Fix for data files in yarn_install and npm_install
# - 0.27.12 Adds NodeModuleSources provider for transtive npm deps support
# - 0.30.0 yarn_install now uses symlinked node_modules with new managed directories Bazel 0.26.0 feature
# - 0.31.1 entry_point attribute of nodejs_binary & rollup_bundle is now a label
# - 0.32.0 yarn_install and npm_install no longer puts build files under symlinked node_modules
# - 0.32.1 remove override of @bazel/tsetse & exclude typescript lib declarations in node_module_library transitive_declarations
# - 0.32.2 resolves bug in @bazel/hide-bazel-files postinstall step
# - 0.34.0 introduces protractor rule
# - 0.37.1 windows fixes
# - 0.38.2 Adds NpmPackageInfo & JSNamedModuleInfo providers
# - 0.38.3 all providers loaded from //:providers.bzl
check_rules_nodejs_version(minimum_version_string = "0.38.3")
check_rules_nodejs_version(minimum_version_string = "0.42.1")
# Setup the Node.js toolchain
node_repositories(
@ -113,12 +85,9 @@ load("@io_bazel_rules_webtesting//web:repositories.bzl", "web_test_repositories"
web_test_repositories()
load("@io_bazel_rules_webtesting//web/versioned:browsers-0.3.2.bzl", "browser_repositories")
load("//tools/browsers:browser_repositories.bzl", "browser_repositories")
browser_repositories(
chromium = True,
firefox = True,
)
browser_repositories()
# Setup the rules_typescript tooolchain
load("@npm_bazel_typescript//:index.bzl", "ts_setup_workspace")
@ -143,14 +112,14 @@ rbe_autoconfig(
# Need to specify a base container digest in order to ensure that we can use the checked-in
# platform configurations for the "ubuntu16_04" image. Otherwise the autoconfig rule would
# need to pull the image and run it in order determine the toolchain configuration. See:
# https://github.com/bazelbuild/bazel-toolchains/blob/0.27.0/configs/ubuntu16_04_clang/versions.bzl
base_container_digest = "sha256:94d7d8552902d228c32c8c148cc13f0effc2b4837757a6e95b73fdc5c5e4b07b",
# https://github.com/bazelbuild/bazel-toolchains/blob/1.1.2/configs/ubuntu16_04_clang/versions.bzl
base_container_digest = "sha256:1ab40405810effefa0b2f45824d6d608634ccddbf06366760c341ef6fbead011",
# Note that if you change the `digest`, you might also need to update the
# `base_container_digest` to make sure marketplace.gcr.io/google/rbe-ubuntu16-04-webtest:<digest>
# and marketplace.gcr.io/google/rbe-ubuntu16-04:<base_container_digest> have
# the same Clang and JDK installed. Clang is needed because of the dependency on
# @com_google_protobuf. Java is needed for the Bazel's test executor Java tool.
digest = "sha256:76e2e4a894f9ffbea0a0cb2fbde741b5d223d40f265dbb9bca78655430173990",
digest = "sha256:0b8fa87db4b8e5366717a7164342a029d1348d2feea7ecc4b18c780bc2507059",
env = clang_env(),
registry = "marketplace.gcr.io",
# We can't use the default "ubuntu16_04" RBE image provided by the autoconfig because we need

View File

@ -104,7 +104,7 @@ You also want to see those changes displayed properly in the doc viewer
with a quick, edit/view cycle time.
For this purpose, use the `yarn docs-watch` task, which watches for changes to source files and only
re-processes the the files necessary to generate the docs that are related to the file that has changed.
re-processes the files necessary to generate the docs that are related to the file that has changed.
Since this task takes shortcuts, it is much faster (often less than 1 second) but it won't produce full
fidelity content. For example, links to other docs and code examples may not render correctly. This is
most particularly noticed in links to other docs and in the embedded examples, which may not always render

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -4,7 +4,7 @@ import { protractor, browser, element, by, ElementFinder } from 'protractor';
const nameSuffix = 'X';
class Hero {
interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
name: string;
}

View File

@ -1,6 +1,6 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
isSecret = false;
isSecret: boolean;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -2,21 +2,23 @@
import { Component } from '@angular/core';
import { QuestionService } from './question.service';
import { QuestionBase } from './question-base';
import { Observable } from 'rxjs';
@Component({
selector: 'app-root',
template: `
<div>
<h2>Job Application for Heroes</h2>
<app-dynamic-form [questions]="questions"></app-dynamic-form>
<app-dynamic-form [questions]="questions$ | async"></app-dynamic-form>
</div>
`,
providers: [QuestionService]
})
export class AppComponent {
questions: any[];
questions$: Observable<QuestionBase<any>[]>;
constructor(service: QuestionService) {
this.questions = service.getQuestions();
this.questions$ = service.getQuestions();
}
}

View File

@ -11,7 +11,7 @@
<option *ngFor="let opt of question.options" [value]="opt.key">{{opt.value}}</option>
</select>
</div>
</div>
<div class="errorMessage" *ngIf="!isValid">{{question.label}} is required</div>
</div>

View File

@ -9,7 +9,7 @@ import { QuestionBase } from './question-base';
templateUrl: './dynamic-form-question.component.html'
})
export class DynamicFormQuestionComponent {
@Input() question: QuestionBase<any>;
@Input() question: QuestionBase<string>;
@Input() form: FormGroup;
get isValid() { return this.form.controls[this.question.key].valid; }
}

View File

@ -12,7 +12,7 @@ import { QuestionControlService } from './question-control.service';
})
export class DynamicFormComponent implements OnInit {
@Input() questions: QuestionBase<any>[] = [];
@Input() questions: QuestionBase<string>[] = [];
form: FormGroup;
payLoad = '';
@ -23,6 +23,6 @@ export class DynamicFormComponent implements OnInit {
}
onSubmit() {
this.payLoad = JSON.stringify(this.form.value);
this.payLoad = JSON.stringify(this.form.getRawValue());
}
}

View File

@ -6,6 +6,8 @@ export class QuestionBase<T> {
required: boolean;
order: number;
controlType: string;
type: string;
options: {key: string, value: string}[];
constructor(options: {
value?: T,
@ -13,7 +15,8 @@ export class QuestionBase<T> {
label?: string,
required?: boolean,
order?: number,
controlType?: string
controlType?: string,
type?: string
} = {}) {
this.value = options.value;
this.key = options.key || '';
@ -21,5 +24,6 @@ export class QuestionBase<T> {
this.required = !!options.required;
this.order = options.order === undefined ? 1 : options.order;
this.controlType = options.controlType || '';
this.type = options.type || '';
}
}

View File

@ -8,7 +8,7 @@ import { QuestionBase } from './question-base';
export class QuestionControlService {
constructor() { }
toFormGroup(questions: QuestionBase<any>[] ) {
toFormGroup(questions: QuestionBase<string>[] ) {
let group: any = {};
questions.forEach(question => {

View File

@ -4,15 +4,15 @@ import { Injectable } from '@angular/core';
import { DropdownQuestion } from './question-dropdown';
import { QuestionBase } from './question-base';
import { TextboxQuestion } from './question-textbox';
import { of } from 'rxjs';
@Injectable()
export class QuestionService {
// TODO: get from a remote source of question metadata
// TODO: make asynchronous
getQuestions() {
let questions: QuestionBase<any>[] = [
let questions: QuestionBase<string>[] = [
new DropdownQuestion({
key: 'brave',
@ -42,6 +42,6 @@ export class QuestionService {
})
];
return questions.sort((a, b) => a.order - b.order);
return of(questions.sort((a, b) => a.order - b.order));
}
}

View File

@ -1,8 +1,8 @@
// #docplaster
// #docregion http-client-module-import, http-client-module
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
// #docregion http-client-module-import
import { HttpClientModule } from '@angular/common/http';
// #enddocregion http-client-module-import
import { ReactiveFormsModule } from '@angular/forms';
@ -12,7 +12,6 @@ import { TopBarComponent } from './top-bar/top-bar.component';
import { ProductListComponent } from './product-list/product-list.component';
import { ProductAlertsComponent } from './product-alerts/product-alerts.component';
import { ProductDetailsComponent } from './product-details/product-details.component';
// #enddocregion http-client-module
import { CartComponent } from './cart/cart.component';
import { ShippingComponent } from './shipping/shipping.component';

View File

@ -1,6 +1,6 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
tid: string; // tax id

View File

@ -1,6 +1,7 @@
{
"description": "Http Guide Testing",
"files":[
"src/app/heroes/hero.ts",
"src/app/heroes/heroes.service.ts",
"src/app/heroes/heroes.service.spec.ts",

View File

@ -28,9 +28,9 @@ describe('HeroesService', () => {
// Inject the http, test controller, and service-under-test
// as they will be referenced by each test.
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
heroService = TestBed.inject(HeroesService);
httpClient = TestBed.get(HttpClient);
httpTestingController = TestBed.get(HttpTestingController);
heroService = TestBed.get(HeroesService);
});
afterEach(() => {
@ -44,7 +44,7 @@ describe('HeroesService', () => {
let expectedHeroes: Hero[];
beforeEach(() => {
heroService = TestBed.inject(HeroesService);
heroService = TestBed.get(HeroesService);
expectedHeroes = [
{ id: 1, name: 'A' },
{ id: 2, name: 'B' },

View File

@ -1,5 +1,12 @@
// #docregion
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppModule } from './app/app.module';
import { environment } from './environments/environment';
if (environment.production) {
enableProdMode();
}
platformBrowserDynamic().bootstrapModule(AppModule);

View File

@ -27,8 +27,8 @@ describe('HttpClient testing', () => {
});
// Inject the http service and test controller for each test
httpClient = TestBed.inject(HttpClient);
httpTestingController = TestBed.inject(HttpTestingController);
httpClient = TestBed.get(HttpClient);
httpTestingController = TestBed.get(HttpTestingController);
});
// #enddocregion setup
// #docregion afterEach
@ -67,6 +67,7 @@ describe('HttpClient testing', () => {
httpTestingController.verify();
});
// #enddocregion get-test
it('can test HttpClient.get with matching header', () => {
const testData: Data = {name: 'Test Data'};

View File

@ -5,7 +5,8 @@
"!**/*.js",
"!src/testing/*.*",
"!src/index-specs.html"
"!src/index-specs.html",
"!src/main-specs.ts"
],
"tags": ["http"]
}

View File

@ -2,6 +2,6 @@
import { registerLocaleData } from '@angular/common';
import localeFr from '@angular/common/locales/fr';
// the second parameter 'fr' is optional
registerLocaleData(localeFr, 'fr');
// the second parameter 'fr-FR' is optional
registerLocaleData(localeFr, 'fr-FR');
// #enddocregion import-locale

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
emotion?: string;

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/observables-in-angular/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -39,9 +39,9 @@ export class ZippyComponent {
Time: {{ time | async }}</div>`
})
export class AsyncObservablePipeComponent {
time = new Observable(observer =>
setInterval(() => observer.next(new Date().toString()), 1000)
);
time = new Observable<string>(observer => {
setInterval(() => observer.next(new Date().toString()), 1000);
});
}
// #enddocregion pipe

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/observables/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/practical-observable-usage/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -1,12 +1,12 @@
import { fromEvent } from 'rxjs';
import { ajax } from 'rxjs/ajax';
import { map, filter, debounceTime, distinctUntilChanged, switchMap } from 'rxjs/operators';
import { debounceTime, distinctUntilChanged, filter, map, switchMap } from 'rxjs/operators';
const searchBox = document.getElementById('search-box');
const typeahead = fromEvent(searchBox, 'input').pipe(
map((e: KeyboardEvent) => e.target.value),
map((e: KeyboardEvent) => (e.target as HTMLInputElement).value),
filter(text => text.length > 2),
debounceTime(10),
distinctUntilChanged(),

View File

@ -42,7 +42,7 @@
<div formArrayName="aliases">
<h3>Aliases</h3> <button (click)="addAlias()">Add Alias</button>
<div *ngFor="let address of aliases.controls; let i=index">
<div *ngFor="let alias of aliases.controls; let i=index">
<!-- The repeated alias template -->
<label>
Alias:

View File

@ -1,8 +1,13 @@
// #docplaster
// #docregion
// #docregion remove-heroes
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
// #enddocregion remove-heroes
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
// #docregion remove-heroes
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
import { HeroesModule } from './heroes/heroes.module';
@ -14,6 +19,13 @@ import { PageNotFoundComponent } from './page-not-found/page-not-found.component
// #docregion module-imports
imports: [
BrowserModule,
// #enddocregion module-imports
// #enddocregion remove-heroes
// #docregion animation-import
BrowserAnimationsModule,
// #enddocregion animation-import
// #docregion remove-heroes
// #docregion module-imports
FormsModule,
HeroesModule,
AppRoutingModule
@ -27,6 +39,7 @@ import { PageNotFoundComponent } from './page-not-found/page-not-found.component
bootstrap: [ AppComponent ]
})
export class AppModule { }
// #enddocregion remove-heroes
// #enddocregion
/*

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -0,0 +1,9 @@
/*
* This example project is special in that it is not a cli app. To run tests appropriate for this
* project, the test command is overwritten in `aio/content/examples/rx-libary/example-config.json`.
*
* This is an empty placeholder file to ensure that `aio/tools/examples/run-example-e2e.js` runs
* tests for this project.
*
* TODO: Fix our infrastructure/tooling, so that this hack is not necessary.
*/

View File

@ -0,0 +1,8 @@
{
"e2e": [
{
"cmd": "yarn",
"args": [ "tsc", "--project", "./" ]
}
]
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
emotion?: string;

View File

@ -4,7 +4,7 @@ import { Component, NgModule, OnInit } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
class Hero {
interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,6 +1,6 @@
// #docregion
// #docregion example
export class Hero {
export interface Hero {
name: string;
power: string;
}

View File

@ -1,6 +1,6 @@
// #docregion
// #docregion example
export class Hero {
export interface Hero {
name: string;
power: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -10,11 +10,11 @@ import { Component, EventEmitter } from '@angular/core';
'label'
],
outputs: [
'change'
'heroChange'
]
})
export class HeroButtonComponent {
change = new EventEmitter<any>();
heroChange = new EventEmitter<any>();
label: string;
}
// #enddocregion example

View File

@ -7,7 +7,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
template: `<button>{{label}}</button>`
})
export class HeroButtonComponent {
@Output() change = new EventEmitter<any>();
@Output() heroChange = new EventEmitter<any>();
@Input() label: string;
}
// #enddocregion example

View File

@ -8,7 +8,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
})
export class HeroButtonComponent {
// Pointless aliases
@Output('changeEvent') change = new EventEmitter<any>();
@Output('heroChangeEvent') heroChange = new EventEmitter<any>();
@Input('labelAttribute') label: string;
}
// #enddocregion example

View File

@ -8,7 +8,7 @@ import { Component, EventEmitter, Input, Output } from '@angular/core';
})
export class HeroButtonComponent {
// No aliases
@Output() change = new EventEmitter<any>();
@Output() heroChange = new EventEmitter<any>();
@Input() label: string;
}
// #enddocregion example

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -11,7 +11,7 @@ import { delay } from 'rxjs/operators';
////////// The App: Services and Components for the tests. //////////////
export class Hero {
export interface Hero {
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,5 +1,5 @@
// #docregion
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -1,4 +1,4 @@
export class Hero {
export interface Hero {
id: number;
name: string;
}

View File

@ -52,7 +52,7 @@ The following options are available for configuring the AoT template compiler.
### `allowEmptyCodegenFiles`
When true, generate all possible files even if they are empty. Default is false. Used by the Bazel build rules to simplify how Bazel rules track file dependencies. Do not use this option outside of the Bazel rules.
When `true`, generate all possible files even if they are empty. Default is `false`. Used by the Bazel build rules to simplify how Bazel rules track file dependencies. Do not use this option outside of the Bazel rules.
### `annotationsAs`
@ -64,40 +64,48 @@ Modifies how Angular-specific annotations are emitted to improve tree-shaking. N
### `annotateForClosureCompiler`
When true, use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted JavaScript with [JSDoc](http://usejsdoc.org/) comments needed by the
[Closure Compiler](https://github.com/google/closure-compiler). Default is false.
When `true`, use [Tsickle](https://github.com/angular/tsickle) to annotate the emitted JavaScript with [JSDoc](http://usejsdoc.org/) comments needed by the
[Closure Compiler](https://github.com/google/closure-compiler). Default is `false`.
### `disableExpressionLowering`
When true (the default), transforms code that is or could be used in an annotation, to allow it to be imported from template factory modules. See [metadata rewriting](guide/aot-compiler#metadata-rewriting) for more information.
When `true` (the default), transforms code that is or could be used in an annotation, to allow it to be imported from template factory modules. See [metadata rewriting](guide/aot-compiler#metadata-rewriting) for more information.
When `false`, disables this rewriting, requiring the rewriting to be done manually.
### `disableTypeScriptVersionCheck`
When `true`, the compiler does not check the TypeScript version and does not report an error when an unsupported version of TypeScript is used. Not recommended, as unsupported versions of TypeScript might have undefined behavior. Default is false.
When `true`, the compiler does not check the TypeScript version and does not report an error when an unsupported version of TypeScript is used. Not recommended, as unsupported versions of TypeScript might have undefined behavior. Default is `false`.
### `enableIvy`
Enables the [Ivy](guide/ivy) compilation and rendering pipeline. Default is `true`, as of version 9. In version 9, you can [opt out of Ivy](guide/ivy#opting-out-of-angular-ivy) to continue using the previous compiler, View Engine.
For library projects generated with the CLI, the `prod` configuration default is `false` in version 9.
### `enableResourceInlining`
When true, replaces the `templateUrl` and `styleUrls` property in all `@Component` decorators with inlined contents in `template` and `styles` properties.
When `true`, replaces the `templateUrl` and `styleUrls` property in all `@Component` decorators with inlined contents in `template` and `styles` properties.
When enabled, the `.js` output of `ngc` does not include any lazy-loaded template or style URLs.
For library projects generated with the CLI, the dev configuration default is `true`.
{@a enablelegacytemplate}
### `enableLegacyTemplate`
When true, enables use of the `<template>` element, which was deprecated in Angular 4.0, in favor of `<ng-template>` (to avoid colliding with the DOM's element of the same name). Default is false. Might be required by some third-party Angular libraries.
When `true`, enables use of the `<template>` element, which was deprecated in Angular 4.0, in favor of `<ng-template>` (to avoid colliding with the DOM's element of the same name). Default is `false`. Might be required by some third-party Angular libraries.
### `flatModuleId`
The module ID to use for importing a flat module (when `flatModuleOutFile` is true). References generated by the template compiler use this module name when importing symbols
from the flat module. Ignored if `flatModuleOutFile` is false.
The module ID to use for importing a flat module (when `flatModuleOutFile` is `true`). References generated by the template compiler use this module name when importing symbols
from the flat module. Ignored if `flatModuleOutFile` is `false`.
### `flatModuleOutFile`
When true, generates a flat module index of the given file name and the corresponding flat module metadata. Use to create flat modules that are packaged similarly to `@angular/core` and `@angular/common`. When this option is used, the `package.json` for the library should refer
When `true`, generates a flat module index of the given file name and the corresponding flat module metadata. Use to create flat modules that are packaged similarly to `@angular/core` and `@angular/common`. When this option is used, the `package.json` for the library should refer
to the generated flat module index instead of the library index file.
Produces only one `.metadata.json` file, which contains all the metadata necessary
@ -112,31 +120,31 @@ If more than one `.ts` file is supplied without a `libraryIndex`, an error is pr
A flat module index `.d.ts` and `.js` is created with the given `flatModuleOutFile` name in the same location as the library index `.d.ts` file.
For example, if a library uses the `public_api.ts` file as the library index of the module, the `tsconfig.json` `files` field would be `["public_api.ts"]`.
The `flatModuleOutFile` options could then be set to (for example) `"index.js"`, which produces `index.d.ts` and `index.metadata.json` files.
The `flatModuleOutFile` option could then be set to (for example) `"index.js"`, which produces `index.d.ts` and `index.metadata.json` files.
The `module` field of the library's `package.json` would be `"index.js"` and the `typings` field
would be `"index.d.ts"`.
### `fullTemplateTypeCheck`
When true (recommended), enables the [binding expression validation](guide/aot-compiler#binding-expression-validation) phase of the template compiler, which uses TypeScript to validate binding expressions.
When `true` (recommended), enables the [binding expression validation](guide/aot-compiler#binding-expression-validation) phase of the template compiler, which uses TypeScript to validate binding expressions. For more information, see [Template type checking](guide/template-typecheck).
Default is currently false.
Default is `false`, but when you use the CLI command `ng new`, it is set to `true` by default in the generated project's configuration.
### `generateCodeForLibraries`
When true (the default), generates factory files (`.ngfactory.js` and `.ngstyle.js`)
When `true` (the default), generates factory files (`.ngfactory.js` and `.ngstyle.js`)
for `.d.ts` files with a corresponding `.metadata.json` file.
When false, factory files are generated only for `.ts` files. Do this when using factory summaries.
When `false`, factory files are generated only for `.ts` files. Do this when using factory summaries.
### `preserveWhitespaces`
When false (the default), removes blank text nodes from compiled templates, which results in smaller emitted template factory modules. Set to true to preserve blank text nodes.
When `false` (the default), removes blank text nodes from compiled templates, which results in smaller emitted template factory modules. Set to `true` to preserve blank text nodes.
### `skipMetadataEmit`
When true, does not to produce `.metadata.json` files. Default is `false`.
When `true`, does not produce `.metadata.json` files. Default is `false`.
The `.metadata.json` files contain information needed by the template compiler from a `.ts`
file that is not included in the `.d.ts` file produced by the TypeScript compiler.
@ -150,14 +158,16 @@ are not valid for this style of TypeScript output. However, we do not recommend
### `skipTemplateCodegen`
When true, does not emit `.ngfactory.js` and `.ngstyle.js` files. This turns off most of the template compiler and disables the reporting of template diagnostics.
When `true`, does not emit `.ngfactory.js` and `.ngstyle.js` files. This turns off most of the template compiler and disables the reporting of template diagnostics.
Can be used to instruct the template compiler to produce `.metadata.json` files for distribution with an `npm` package while avoiding the production of `.ngfactory.js` and `.ngstyle.js` files that cannot be distributed to `npm`.
For library projects generated with the CLI, the dev configuration default is `true`.
### `strictMetadataEmit`
When true, reports an error to the `.metadata.json` file if `"skipMetadataEmit"` is `false`.
Default is false. Use only when `"skipMetadataEmit"` is false and `"skipTemplateCodeGen"` is true.
When `true`, reports an error to the `.metadata.json` file if `"skipMetadataEmit"` is `false`.
Default is `false`. Use only when `"skipMetadataEmit"` is `false` and `"skipTemplateCodeGen"` is `true`.
This option is intended to validate the `.metadata.json` files emitted for bundling with an `npm` package. The validation is strict and can emit errors for metadata that would never produce an error when used by the template compiler. You can choose to suppress the error emitted by this option for an exported symbol by including `@dynamic` in the comment documenting the symbol.
@ -170,10 +180,21 @@ If the client of a library intends to use a symbol in an annotation, the templat
This option allows detection of these errors during the build phase of
the library and is used, for example, in producing Angular libraries themselves.
For library projects generated with the CLI, the dev configuration default is `true`.
### `strictInjectionParameters`
When true (recommended), reports an error for a supplied parameter whose injection type cannot be determined. When false (currently the default), constructor parameters of classes marked with `@Injectable` whose type cannot be resolved produce a warning.
When `true` (recommended), reports an error for a supplied parameter whose injection type cannot be determined. When `false` (currently the default), constructor parameters of classes marked with `@Injectable` whose type cannot be resolved produce a warning.
When you use the CLI command `ng new`, it is set to `true` by default in the generated project's configuration.
### `strictTemplates`
When `true`, enables [strict template type checking](guide/template-typecheck#strict-mode) in Angular version 9. Strict mode is only available when using [Ivy](guide/ivy).
Additional strictness flags allow you to enable and disable specific types of strict template type checking. See [troubleshooting template errors](guide/template-typecheck#troubleshooting-template-errors).
### `trace`
When true, prints extra information while compiling templates. Default is false.
When `true`, prints extra information while compiling templates. Default is `false`.

View File

@ -69,11 +69,9 @@ Let's animate a simple transition that changes a single HTML element from one st
In HTML, these attributes are set using ordinary CSS styles such as color and opacity. In Angular, use the `style()` function to specify a set of CSS styles for use with animations. You can collect a set of styles in an animation state, and give the state a name, such as `open` or `closed`.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/animations/open-closed.png" alt="open and closed states">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/animations/open-closed.png" alt="open and closed states">
</div>
### Animation state and styles
@ -168,11 +166,9 @@ The `trigger()` function describes the property name to watch for changes. When
In this example, we'll name the trigger `openClose`, and attach it to the `button` element. The trigger describes the open and closed states, and the timings for the two transitions.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/animations/triggering-the-animation.png" alt="triggering the animation">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/animations/triggering-the-animation.png" alt="triggering the animation">
</div>
<div class="alert is-helpful">

View File

@ -51,11 +51,9 @@ You define a component's view with its companion template. A template is a form
Views are typically arranged hierarchically, allowing you to modify or show and hide entire UI sections or pages as a unit. The template immediately associated with a component defines that component's *host view*. The component can also define a *view hierarchy*, which contains *embedded views*, hosted by other components.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/component-tree.png" alt="Component tree" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/component-tree.png" alt="Component tree" class="left">
</div>
A view hierarchy can include views from components in the same NgModule, but it also can (and often does) include views from components that are defined in different NgModules.
@ -83,11 +81,9 @@ Angular supports *two-way data binding*, a mechanism for coordinating the parts
The following diagram shows the four forms of data binding markup. Each form has a direction: to the DOM, from the DOM, or both.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/databinding.png" alt="Data Binding" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/databinding.png" alt="Data Binding" class="left">
</div>
This example from the `HeroListComponent` template uses three of these forms.
@ -114,19 +110,15 @@ as with event binding.
Angular processes *all* data bindings once for each JavaScript event cycle,
from the root of the application component tree through all child components.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/component-databinding.png" alt="Data Binding" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/component-databinding.png" alt="Data Binding" class="left">
</div>
Data binding plays an important role in communication between a template and its component, and is also important for communication between parent and child components.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/parent-child-binding.png" alt="Parent/Child binding" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/parent-child-binding.png" alt="Parent/Child binding" class="left">
</div>
### Pipes

View File

@ -35,21 +35,17 @@ Here's a simple root NgModule definition.
NgModules provide a *compilation context* for their components. A root NgModule always has a root component that is created during bootstrap, but any NgModule can include any number of additional components, which can be loaded through the router or created through the template. The components that belong to an NgModule share a compilation context.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/compilation-context.png" alt="Component compilation context" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/compilation-context.png" alt="Component compilation context" class="left">
</div>
<br class="clear">
A component and its template together define a *view*. A component can contain a *view hierarchy*, which allows you to define arbitrarily complex areas of the screen that can be created, modified, and destroyed as a unit. A view hierarchy can mix views defined in components that belong to different NgModules. This is often the case, especially for UI libraries.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/view-hierarchy.png" alt="View hierarchy" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/view-hierarchy.png" alt="View hierarchy" class="left">
</div>
<br class="clear">

View File

@ -70,11 +70,9 @@ When all requested services have been resolved and returned, Angular can call th
The process of `HeroService` injection looks something like this.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/injector-injects.png" alt="Service" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/injector-injects.png" alt="Service" class="left">
</div>
### Providing services

View File

@ -113,11 +113,9 @@ To define navigation rules, you associate *navigation paths* with your component
You've learned the basics about the main building blocks of an Angular application. The following diagram shows how these basic pieces are related.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/architecture/overview2.png" alt="overview">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/architecture/overview2.png" alt="overview">
</div>
* Together, a component and template define an Angular view.
* A decorator on a component class adds the metadata, including a pointer to the associated template.

View File

@ -175,11 +175,9 @@ Here's the updated directive in full:
Run the app and confirm that the background color appears when
the mouse hovers over the `p` and disappears as it moves out.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/attribute-directives/highlight-directive-anim.gif" alt="Second Highlight">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/attribute-directives/highlight-directive-anim.gif" alt="Second Highlight">
</div>
{@a bindings}
@ -273,11 +271,9 @@ Revise the `AppComponent.color` so that it has no initial value.
Here are the harness and directive in action.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/attribute-directives/highlight-directive-v2-anim.gif" alt="Highlight v.2">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/attribute-directives/highlight-directive-v2-anim.gif" alt="Highlight v.2">
</div>
{@a second-property}
@ -311,11 +307,9 @@ because you made it _public_ with the `@Input` decorator.
Here's how the harness should work when you're done coding.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/attribute-directives/highlight-directive-final-anim.gif" alt="Final Highlight">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/attribute-directives/highlight-directive-final-anim.gif" alt="Final Highlight">
</div>
## Summary

View File

@ -7,7 +7,7 @@ A basic understanding of the following:
<hr />
An NgModule describes how the application parts fit together.
An `NgModule` describes how the application parts fit together.
Every application has at least one Angular module, the _root_ module
that you bootstrap to launch the application.
By convention, it is usually called `AppModule`.
@ -109,7 +109,7 @@ The following example, named `ItemDirective` is the default directive structure
<code-example path="bootstrapping/src/app/item.directive.ts" region="directive" header="src/app/item.directive.ts"></code-example>
The key point here is that you have to export it so you can import it elsewhere. Next, import it
into the NgModule, in this example `app.module.ts`, with a JavaScript import statement:
into the `NgModule`, in this example `app.module.ts`, with a JavaScript import statement:
<code-example path="bootstrapping/src/app/app.module.ts" region="directive-import" header="src/app/app.module.ts"></code-example>

View File

@ -325,7 +325,7 @@ For more information, see [Autoprefixer documentation](https://autoprefixer.gith
## Proxying to a backend server
You can use the [proxying support](https://webpack.js.org/configuration/dev-server/#devserver-proxy) in the `webpack` dev server to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option.
You can use the [proxying support](https://webpack.js.org/configuration/dev-server/#devserverproxy) in the `webpack` dev server to divert certain URLs to a backend server, by passing a file to the `--proxy-config` build option.
For example, to divert all calls for `http://localhost:4200/api` to a server running on `http://localhost:3000/api`, take the following steps.
1. Create a file `proxy.conf.json` in your project's `src/` folder.
@ -356,7 +356,7 @@ For example, to divert all calls for `http://localhost:4200/api` to a server run
1. To run the dev server with this proxy configuration, call `ng serve`.
You can edit the proxy configuration file to add configuration options; some examples are given below.
For a description of all options, see [webpack DevServer documentation](https://webpack.js.org/configuration/dev-server/#devserver-proxy).
For a description of all options, see [webpack DevServer documentation](https://webpack.js.org/configuration/dev-server/#devserverproxy).
Note that if you edit the proxy configuration file, you must relaunch the `ng serve` process to make your changes effective.

View File

@ -50,11 +50,9 @@ and each iteration's `hero` instance to the child's `hero` property.
The running application displays three heroes:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/parent-to-child.png" alt="Parent-to-child">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/parent-to-child.png" alt="Parent-to-child">
</div>
@ -96,11 +94,9 @@ Here's the `NameParentComponent` demonstrating name variations including a name
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/setter.png" alt="Parent-to-child-setter">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/setter.png" alt="Parent-to-child-setter">
</div>
@ -156,11 +152,9 @@ The `VersionParentComponent` supplies the `minor` and `major` values and binds b
Here's the output of a button-pushing sequence:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/parent-to-child-on-changes.gif" alt="Parent-to-child-onchanges">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/parent-to-child-on-changes.gif" alt="Parent-to-child-onchanges">
</div>
@ -212,11 +206,9 @@ The framework passes the event argument&mdash;represented by `$event`&mdash;to t
and the method processes it:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/child-to-parent.gif" alt="Child-to-parent">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/child-to-parent.gif" alt="Child-to-parent">
</div>
@ -276,11 +268,9 @@ uses interpolation to display the child's `seconds` property.
Here we see the parent and child working together.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/countdown-timer-anim.gif" alt="countdown timer">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/countdown-timer-anim.gif" alt="countdown timer">
</div>
@ -431,11 +421,9 @@ the parent `MissionControlComponent` and the `AstronautComponent` children,
facilitated by the service:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/component-interaction/bidirectional-service.gif" alt="bidirectional-service">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/component-interaction/bidirectional-service.gif" alt="bidirectional-service">
</div>

View File

@ -109,11 +109,10 @@ To learn more, see [Schematics Overview](guide/schematics) and [Schematicsfor
## Publishing your library
Use the Angular CLI and the npm package manager to build and publish your library as an npm package.
Libraries are built in [AoT mode](guide/aot-compiler) by default, so you do not need to specify the `-prod` flag when building for publication.
Use the Angular CLI and the npm package manager to build and publish your library as an npm package. It is not recommended to publish Ivy libraries to NPM repositories. Before publishing a library to NPM, build it using the `--prod` flag which will use the older compiler and runtime known as View Engine instead of Ivy.
<code-example language="bash">
ng build my-lib
ng build my-lib --prod
cd dist/my-lib
npm publish
</code-example>

View File

@ -40,11 +40,9 @@ and the framework resolves the nested dependencies.
When all dependencies are in place, `AppComponent` displays the user information.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/logged-in-user.png" alt="Logged In User">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/logged-in-user.png" alt="Logged In User">
</div>
{@a service-scope}
@ -133,11 +131,9 @@ The template displays this data-bound property.
Find this example in <live-example name="dependency-injection-in-action">live code</live-example>
and confirm that the three `HeroBioComponent` instances have their own cached hero data.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/hero-bios.png" alt="Bios">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/hero-bios.png" alt="Bios">
</div>
{@a qualify-dependency-lookup}
@ -195,11 +191,9 @@ placing it in the `<ng-content>` slot of the `HeroBioComponent` template.
The result is shown below, with the hero's telephone number from `HeroContactComponent` projected above the hero description.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/hero-bio-and-content.png" alt="bio and contact">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/hero-bio-and-content.png" alt="bio and contact">
</div>
Here's `HeroContactComponent`, which demonstrates the qualifying decorators.
@ -227,11 +221,9 @@ When the property is marked as optional, Angular sets `loggerService` to null an
Here's `HeroBiosAndContactsComponent` in action.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/hero-bios-and-contacts.png" alt="Bios with contact into">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/hero-bios-and-contacts.png" alt="Bios with contact into">
</div>
@ -240,11 +232,9 @@ until it finds the logger at the `AppComponent` level.
The logger logic kicks in and the hero display updates
with the "!!!" marker to indicate that the logger was found.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/hero-bio-contact-no-host.png" alt="Without @Host">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/hero-bio-contact-no-host.png" alt="Without @Host">
</div>
If you restore the `@Host()` decorator and comment out `@Optional`,
@ -304,11 +294,9 @@ first without a value (yielding the default color) and then with an assigned col
The following image shows the effect of mousing over the `<hero-bios-and-contacts>` tag.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/highlight.png" alt="Highlighted bios">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/highlight.png" alt="Highlighted bios">
</div>
{@a providers}
@ -359,11 +347,9 @@ You learned about some other methods in [Dependency Providers](guide/dependency-
The following `HeroOfTheMonthComponent` example demonstrates many of the alternatives and why you need them.
It's visually simple: a few properties and the logs produced by a logger.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/hero-of-month.png" alt="Hero of the month">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/hero-of-month.png" alt="Hero of the month">
</div>
The code behind it customizes how and where the DI framework provides dependencies.
The use cases illustrate different ways to use the [*provide* object literal](guide/dependency-injection-providers#provide) to associate a definition object with a DI token.
@ -474,11 +460,9 @@ The following example puts `MinimalLogger` to use in a simplified version of `He
The `HeroOfTheMonthComponent` constructor's `logger` parameter is typed as `MinimalLogger`, so only the `logs` and `logInfo` members are visible in a TypeScript-aware editor.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/minimal-logger-intellisense.png" alt="MinimalLogger restricted API">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/minimal-logger-intellisense.png" alt="MinimalLogger restricted API">
</div>
Behind the scenes, Angular sets the `logger` parameter to the full service registered under the `LoggingService` token, which happens to be the `DateLoggerService` instance that was [provided above](guide/dependency-injection-in-action#useclass).
@ -488,11 +472,9 @@ Behind the scenes, Angular sets the `logger` parameter to the full service regis
This is illustrated in the following image, which displays the logging date.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/date-logger-entry.png" alt="DateLoggerService entry">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/date-logger-entry.png" alt="DateLoggerService entry">
</div>
</div>
@ -645,11 +627,9 @@ and then pass them down to the base class through the constructor.
In this contrived example, `SortedHeroesComponent` inherits from `HeroesBaseComponent`
to display a *sorted* list of heroes.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/sorted-heroes.png" alt="Sorted Heroes">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/sorted-heroes.png" alt="Sorted Heroes">
</div>
The `HeroesBaseComponent` can stand on its own.
It demands its own instance of `HeroService` to get heroes

View File

@ -145,11 +145,9 @@ the same way you've done it before.
Here's *Alex* and family in action.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/alex.png" alt="Alex in action">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/alex.png" alt="Alex in action">
</div>
@ -203,13 +201,9 @@ which *is* what parent means.
Here's *Alice*, *Barry*, and family in action.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection-in-action/alice.png" alt="Alice in action">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection-in-action/alice.png" alt="Alice in action">
</div>
{@a parent-token}

View File

@ -140,7 +140,7 @@ Check out [angular-cli-ghpages](https://github.com/angular-buch/angular-cli-ghpa
## Server configuration
This section covers changes you may have make to the server or to files deployed to the server.
This section covers changes you may have to make to the server or to files deployed on the server.
{@a fallback}
@ -230,7 +230,7 @@ modified to serve `index.html`:
http.ListenAndServe(":"+httpPort, nil)
}
```
* [Ruby](https://www.ruby-lang.org/): create a Ruby server using ([sinatra](http://sinatrarb.com/)) with a basic Ruby file that configures the server `server.rb`:
``` ruby
@ -367,7 +367,7 @@ Bundlers don't know about the router configuration and can't create separate bun
You would have to create these bundles manually.
The CLI runs the
[Angular Ahead-of-Time Webpack Plugin](https://github.com/angular/angular-cli/tree/master/packages/%40ngtools/webpack)
[Angular Ahead-of-Time Webpack Plugin](https://github.com/angular/angular-cli/tree/master/packages/ngtools/webpack)
which automatically recognizes lazy-loaded `NgModules` and creates separate bundles for them.
</div>
@ -434,11 +434,9 @@ showing exactly which classes are included in the bundle.
Here's the output for the _main_ bundle of an example app called `cli-quickstart`.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/deployment/quickstart-sourcemap-explorer.png" alt="quickstart sourcemap explorer">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/deployment/quickstart-sourcemap-explorer.png" alt="quickstart sourcemap explorer">
</div>
{@a base-tag}
@ -470,7 +468,7 @@ for the missing files. Look at where it _tried_ to find those files and adjust t
## Differential Loading
When building web applications, making sure your application is compatible with the majority of browsers is a goal.
When building web applications, you want to make sure your application is compatible with the majority of browsers.
Even as JavaScript continues to evolve, with new features being introduced, not all browsers are updated with support for these new features at the same pace.
The code you write in development using TypeScript is compiled and bundled into ES2015, the JavaScript syntax that is compatible with most browsers.
@ -481,42 +479,40 @@ To maximize compatibility, you could ship a single bundle that includes all your
Users with modern browsers, however, shouldn't have to pay the price of increased bundle size that comes with polyfills they don't need.
Differential loading, which is supported by default in Angular CLI version 8 and higher, solves this problem.
Differential loading is a strategy where the CLI builds two separate bundles as part of your deployed application.
Differential loading is a strategy that allows your web application to support multiple browsers, but only load the necessary code that the browser needs. When differential loading is enabled (which is the default) the CLI builds two separate bundles as part of your deployed application.
* The first bundle contains modern ES2015 syntax, takes advantage of built-in support in modern browsers, ships less polyfills, and results in a smaller bundle size.
* The first bundle contains modern ES2015 syntax, takes advantage of built-in support in modern browsers, ships fewer polyfills, and results in a smaller bundle size.
* The second bundle contains code in the old ES5 syntax, along with all necessary polyfills. This results in a larger bundle size, but supports older browsers.
This strategy allows you to continue to build your web application to support multiple browsers, but only load the necessary code that the browser needs.
### Differential builds
The Angular CLI handles differential loading for you as part of the _build_ process for deployment.
The `ng build` command produces the necessary bundles used for differential loading, based on your browser support requirements and compilation target.
When you deploy using the Angular CLI build process, you can choose how and when to support differential loading.
The [`ng build` CLI command](cli/build) queries the browser configuration and the configured build target to determine if support for legacy browsers is required, and whether the build should produce the necessary bundles used for differential loading.
The Angular CLI uses two configurations for differential loading:
The following configurations determine your requirements.
* Browsers list
The `browserslist` configuration file is included in your application [project structure](guide/file-structure#application-configuration-files) and provides the minimum browsers your application supports. See the [Browserslist spec](https://github.com/browserslist/browserslist) for complete configuration options.
* TypeScript configuration
In the TypeScript configuration file, `tsconfig.json`, the `target` in the `compilerOptions` section determines the ECMAScript target version that the code is compiled to.
In the TypeScript configuration file, `tsconfig.json`, the "target" option in the `compilerOptions` section determines the ECMAScript target version that the code is compiled to.
Modern browsers support ES2015 natively, while ES5 is more commonly used to support legacy browsers.
<div class="alert is-helpful">
Differential loading is currently only supported when using `es2015` as a compilation `target`. When used with targets higher than `es2015`, a warning is emitted during build time.
Differential loading is currently only supported when using `es2015` as a compilation target. When used with targets higher than `es2015`, the build process emits a warning.
</div>
The CLI queries the Browserslist configuration, and checks the `target` to determine if support for legacy browsers is required.
The combination of these two configurations determines whether multiple bundles are produced when you create a _build_.
When you create a development build using [`ng build`](cli/build) and differential loading is enabled, the output produced is simpler and easier to debug, allowing you to rely less on sourcemaps of compiled code.
When you create a production build using [`ng build --prod`](cli/build), the CLI uses the defined configurations above to determine the bundles to build for deployment of your application.
For a development build, the output produced by `ng build` is simpler and easier to debug, allowing you to rely less on sourcemaps of compiled code.
The `index.html` file is also modified during the build process to include script tags that enable differential loading. See the sample output below from the `index.html` file produced during a build using `ng build`.
For a production build, your configuration determines which bundles are created for deployment of your application.
When needed, the `index.html` file is also modified during the build process to include script tags that enable differential loading, as shown in the following example.
<code-example language="html">
<code-example language="html" header="index.html">
&lt;body>
&lt;app-root>&lt;/app-root>
&lt;script src="runtime-es2015.js" type="module">&lt;/script>
@ -540,26 +536,22 @@ Each script tag has a `type="module"` or `nomodule` attribute. Browsers with nat
</div>
See the [configuration table](#configuration-table) below for the configurations for enabling differential loading.
### Configuring differential loading
Differential loading is supported by default with version 8 and later of the Angular CLI.
For each application project in your workspace, you can configure how builds are produced based on the `browserslist` and `tsconfig.json` files in your application project.
For each application project in your workspace, you can configure how builds are produced based on the `browserslist` and `tsconfig.json` configuration files in your application project.
For a newly created Angular application, the default `browserslist` looks like this:
For a newly created Angular application, legacy browsers such as IE 9-11 are ignored, and the compilation target is ES2015.
```
<code-example language="none" header="browserslist">
> 0.5%
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
```
</code-example>
The `tsconfig.json` looks like this:
<code-example language="json">
<code-example language="json" header="tsconfig.json">
{
"compileOnSave": false,
@ -586,33 +578,35 @@ The `tsconfig.json` looks like this:
</code-example>
By default, legacy browsers such as IE 9-11 are ignored, and the compilation target is ES2015. As a result, this produces two builds, and differential loading is enabled. If you ignore browsers without ES2015 support, a single build is produced. To see the build result for differential loading based on different configurations, refer to the table below.
The default configuration creates two builds, with differential loading enabled.
<div class="alert is-important">
To see which browsers are supported with the above configuration, see which settings meet to your browser support requirements, see the [Browserslist compatibility page](https://browserl.ist/?q=%3E+0.5%25%2C+last+2+versions%2C+Firefox+ESR%2C+not+dead%2C+not+IE+9-11).
To see which browsers are supported with the default configuration and determine which settings meet to your browser support requirements, see the [Browserslist compatibility page](https://browserl.ist/?q=%3E+0.5%25%2C+last+2+versions%2C+Firefox+ESR%2C+not+dead%2C+not+IE+9-11).
</div>
The `browserslist` configuration allows you to ignore browsers without ES2015 support. In this case, a single build is produced.
If your `browserslist` configuration includes support for any legacy browsers, the build target in the TypeScript configuration determines whether the build will support differential loading.
{@a configuration-table }
| ES5 Browserslist Result | ES Target | Build Result |
| browserslist | ES target | Build result |
| -------- | -------- | -------- |
| disabled | es5 | Single build |
| enabled | es5 | Single build w/Conditional Polyfills |
| disabled | es2015 | Single build |
| enabled | es2015 | Differential Loading (Two builds w/Conditional Polyfills |
| ES5 support disabled | es2015 | Single build, ES5 not required |
| ES5 support enabled | es5 | Single build w/conditional polyfills for ES5 only |
| ES5 support enabled | es2015 | Differential loading (two builds w/conditional polyfills) |
When the ES5 Browserslist result is `disabled`, then ES5 browser support is not required. Otherwise, ES5 browser support is required.
### Opting out of differential loading
Differential loading can be explicitly disabled if it causes unexpected issues or you need to target ES5 specifically for legacy browser support.
Differential loading can be explicitly disabled if it causes unexpected issues, or if you need to target ES5 specifically for legacy browser support.
To explicitly disable differential loading:
To explicitly disable differential loading and create an ES5 build:
- Enable the `dead` or `IE` browsers in the `browserslist` config file by removing the `not` keyword in front of them.
- Set the `target` in the `compilerOptions` to `es5`.
- Enable the `dead` or `IE` browsers in the `browserslist` configuration file by removing the `not` keyword in front of them.
- To create a single ES5 build, set the target in the `compilerOptions` to `es5`.
{@a test-and-serve}
@ -669,7 +663,7 @@ In `angular.json` add two new configuration sections under the `build` and `serv
...
},
"es5": {
"browserTarget": "<app-name>:build:es5"
"browserTarget": "&lt;app-name&gt;:build:es5"
}
}
},
@ -741,7 +735,7 @@ Create an [ES5 serve configuration](guide/deployment#configuring-serve-for-es5)
...
},
"es5": {
"devServerTarget": "<app-name>:serve:es5"
"devServerTarget": "&lt;app-name&gt;:serve:es5"
}
}
},

View File

@ -41,11 +41,6 @@ v9 - v12
| `@angular/core` | [`ReflectiveKey`](#core) | <!--v8--> v10 |
| `@angular/core` | [`RenderComponentType`](#core) | <!--v7--> v10 |
| `@angular/core` | [`ViewEncapsulation.Native`](#core) | <!--v6--> v10 |
| `@angular/core` | [`WtfScopeFn`](api/core/WtfScopeFn) | <!--v8--> v10 |
| `@angular/core` | [`wtfCreateScope`](api/core/wtfCreateScope) | <!--v8--> v10 |
| `@angular/core` | [`wtfStartTimeRange`](api/core/wtfStartTimeRange) | <!--v8--> v10 |
| `@angular/core` | [`wtfEndTimeRange`](api/core/wtfEndTimeRange) | <!--v8--> v10 |
| `@angular/core` | [`wtfLeave`](api/core/wtfLeave) | <!--v8--> v10 |
| `@angular/core` | [`ModuleWithProviders` without a generic](#moduleWithProviders) | <!--v9--> v10 |
| `@angular/forms` | [`ngModel` with reactive forms](#ngmodel-reactive) | <!--v6--> v10 |
| `@angular/router` | [`preserveQueryParams`](#router) | <!--v7--> v10 |
@ -89,11 +84,6 @@ Tip: In the [API reference section](api) of this doc site, deprecated APIs are i
| [`ReflectiveKey`](api/core/ReflectiveKey) | none | v5 | none |
| [`ViewEncapsulation.Native`](api/core/ViewEncapsulation#Native) | [`ViewEncapsulation.ShadowDom`](api/core/ViewEncapsulation#ShadowDom) | v6 | Use the native encapsulation mechanism of the renderer. See [view.ts](https://github.com/angular/angular/blob/3e992e18ebf51d6036818f26c3d77b52d3ec48eb/packages/core/src/metadata/view.ts#L32).
| [`defineInjectable`](api/core/defineInjectable) | `ɵɵdefineInjectable` | v8 | Used only in generated code. No source code should depend on this API. |
| [`WtfScopeFn`](api/core/WtfScopeFn) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfCreateScope`](api/core/wtfCreateScope) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfStartTimeRange`](api/core/wtfStartTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfEndTimeRange`](api/core/wtfEndTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`wtfLeave`](api/core/wtfLeave) | none | v8 | See [Web Tracing Framework](#wtf) |
| [`entryComponents`](api/core/NgModule#entryComponents) | none | v9 | See [`entryComponents`](#entryComponents) |
| [`ANALYZE_FOR_ENTRY_COMPONENTS`](api/core/ANALYZE_FOR_ENTRY_COMPONENTS) | none | v9 | See [`ANALYZE_FOR_ENTRY_COMPONENTS`](#entryComponents) |
| `ModuleWithProviders` without a generic | `ModuleWithProviders` with a generic | v9 | See [`ModuleWithProviders` section](#moduleWithProviders) |
@ -166,7 +156,7 @@ This section lists all of the currently-deprecated features, which includes temp
{@a wtf}
### Web Tracing Framework integration
Angular previously has supported an integration with the Web Tracing Framework (WTF) for performance testing of Angular applications. This integration has not been maintained and likely does not work for the majority of Angular applications today. As a result, we are deprecating the integration in Angular version 8.
Angular previously has supported an integration with the [Web Tracing Framework (WTF)](https://google.github.io/tracing-framework/) for performance testing of Angular applications. This integration has not been maintained and defunct. As a result, the integration was deprecated in Angular version 8 and due to no evidence of any existing usage removed in version 9.
{@a deep-component-style-selector}
@ -454,6 +444,11 @@ The following APIs have been removed starting with version 9.0.0*:
| `@angular/core` | [`Renderer`](https://v8.angular.io/api/core/Renderer) | [`Renderer2`](https://angular.io/api/core/Renderer2) | [Migration guide](guide/migration-renderer) |
| `@angular/core` | [`RootRenderer`](https://v8.angular.io/api/core/RootRenderer) | [`RendererFactory2`](https://angular.io/api/core/RendererFactory2) | none |
| `@angular/core` | [`RenderComponentType`](https://v8.angular.io/api/core/RenderComponentType) | [`RendererType2`](https://angular.io/api/core/RendererType2) | none |
| `@angular/core` | [`WtfScopeFn`](https://v8.angular.io/api/core/WtfScopeFn) | none | v8 | See [Web Tracing Framework](#wtf) |
| `@angular/core` | [`wtfCreateScope`](https://v8.angular.io/api/core/wtfCreateScope) | none | v8 | See [Web Tracing Framework](#wtf) |
| `@angular/core` | [`wtfStartTimeRange`](https://v8.angular.io/api/core/wtfStartTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| `@angular/core` | [`wtfEndTimeRange`](https://v8.angular.io/api/core/wtfEndTimeRange) | none | v8 | See [Web Tracing Framework](#wtf) |
| `@angular/core` | [`wtfLeave`](https://v8.angular.io/api/core/wtfLeave) | none | v8 | See [Web Tracing Framework](#wtf) |
| `@angular/common` | `DeprecatedI18NPipesModule` | [`CommonModule`](api/common/CommonModule#pipes) | none |
| `@angular/common` | `DeprecatedCurrencyPipe` | [`CurrencyPipe`](api/common/CurrencyPipe) | none |
| `@angular/common` | `DeprecatedDatePipe` | [`DatePipe`](api/common/DatePipe) | none |

View File

@ -8,12 +8,9 @@ conditionally show a message below the list.
The final UI looks like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/displaying-data/final.png" alt="Final UI">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/displaying-data/final.png" alt="Final UI">
</div>
<div class="alert is-helpful">
@ -105,13 +102,9 @@ inside the `<app-root>` tag.
Now run the app. It should display the title and hero name:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/displaying-data/title-and-hero.png" alt="Title and Hero">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/displaying-data/title-and-hero.png" alt="Title and Hero">
</div>
The next few sections review some of the coding choices in the app.
@ -215,14 +208,9 @@ repeat items for any [iterable](https://developer.mozilla.org/en-US/docs/Web/Jav
Now the heroes appear in an unordered list.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/displaying-data/hero-names-list.png" alt="After ngfor">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/displaying-data/hero-names-list.png" alt="After ngfor">
</div>
## Creating a class for the data

View File

@ -1244,19 +1244,20 @@ Images should be specified in an `<img>` tag.
For accessibility, always set the `alt` attribute with a meaningful description of the image.
You should nest the `<img>` tag within a `<figure>` tag, which styles the image within a drop-shadow frame. You'll need the editor's permission to skip the `<figure>` tag.
You should nest the `<img>` tag within a `<div class="lightbox">` tag, which styles the image within a drop-shadow frame. You'll need the editor's permission to skip the `lightbox` class on its `div` encapsulation.
Here's a conforming example
<figure>
<img src="generated/images/guide/docs-style-guide/flying-hero.png" alt="flying hero">
</figure>
<div class="lightbox">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying hero">
</div>
```html
<figure>
<div class="lightbox">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying hero">
</figure>
alt="flying hero">
</div>
```
_Note that the HTML image element does not have a closing tag._
@ -1267,17 +1268,19 @@ The doc generator reads the image dimensions from the file and adds width and he
Here's the "flying hero" at a more reasonable scale.
<figure>
<img src="generated/images/guide/docs-style-guide/flying-hero.png" alt="flying Angular hero" width="200">
</figure>
<div class="lightbox">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying Angular hero"
width="200">
</div>
```html
<figure>
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying Angular hero"
width="200">
</figure>
<div class="lightbox">
<img src="generated/images/guide/docs-style-guide/flying-hero.png"
alt="flying Angular hero"
width="200">
</div>
```
Wide images can be a problem. Most browsers try to rescale the image but wide images may overflow the document in certain viewports.
@ -1285,9 +1288,9 @@ Wide images can be a problem. Most browsers try to rescale the image but wide im
**Do not set a width greater than 700px**. If you wish to display a larger image, provide a link to the actual image that the user can click on to see the full size image separately as in this example of `source-map-explorer` output from the "Ahead-of-time Compilation" guide:
<a href="generated/images/guide/docs-style-guide/toh-pt6-bundle.png" title="Click to view larger image">
<figure>
<div class="lightbox">
<img src="generated/images/guide/docs-style-guide/toh-pt6-bundle-700w.png" alt="toh-pt6-bundle" width="300px">
</figure>
</div>
</a>
<h3 class="no-toc">Image compression</h3>

View File

@ -183,12 +183,8 @@ Here are two sample components and the `AdComponent` interface for reference:
## Final ad banner
The final ad banner looks like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dynamic-component-loader/ads-example.gif" alt="Ads">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dynamic-component-loader/ads-example.gif" alt="Ads">
</div>
See the <live-example name="dynamic-component-loader"></live-example>.

View File

@ -197,12 +197,9 @@ Saving and retrieving the data is an exercise for another time.
The final form looks like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dynamic-form/dynamic-form.png" alt="Dynamic-Form">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dynamic-form/dynamic-form.png" alt="Dynamic-Form">
</div>
[Back to top](guide/dynamic-form#top)

View File

@ -42,11 +42,9 @@ After you register your configured class with the browser's custom-element regis
When your custom element is placed on a page, the browser creates an instance of the registered class and adds it to the DOM. The content is provided by the component's template, which uses Angular template syntax, and is rendered using the component and DOM data. Input properties in the component correspond to input attributes for the element.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/elements/customElement1.png" alt="Custom element in browser" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/elements/customElement1.png" alt="Custom element in browser" class="left">
</div>
<hr class="clear">
@ -64,11 +62,9 @@ Use a JavaScript function, `customElements.define()`, to register the configure
and its associated custom-element tag with the browser's `CustomElementRegistry`.
When the browser encounters the tag for the registered element, it uses the constructor to create a custom-element instance.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/elements/createElement.png" alt="Transform a component to a custom element" class="left">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/elements/createElement.png" alt="Transform a component to a custom element" class="left">
</div>
### Mapping
@ -107,7 +103,7 @@ The recently-developed [custom elements](https://developer.mozilla.org/en-US/doc
</tr>
<tr>
<td>Firefox</td>
<td>Supported natively as of version 63. In older versions: Set the <code>dom.webcomponents.enabled</code> and <code>dom.webcomponents.customelements.enabled</code> preferences to true.</td>
<td>Supported natively.</td>
</tr>
<tr>
<td>Edge</td>

View File

@ -102,12 +102,9 @@ Next, in the `AppComponent`, `app.component.html`, add the tag `<app-customer-da
Now, in addition to the title that renders by default, the `CustomerDashboardComponent` template renders too:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/feature-modules/feature-module.png" alt="feature module component">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/feature-modules/feature-module.png" alt="feature module component">
</div>
<hr />

View File

@ -101,7 +101,7 @@ Project-specific [TypeScript](https://www.typescriptlang.org/) configuration fil
| :--------------------- | :------------------------------------------|
| `browserslist` | Configures sharing of target browsers and Node.js versions among various front-end tools. See [Browserslist on GitHub](https://github.com/browserslist/browserslist) for more information. |
| `karma.conf.js` | Application-specific [Karma](https://karma-runner.github.io/2.0/config/configuration-file.html) configuration. |
| `tsconfig.app.json` | Application-specific [TypeScript](https://www.typescriptlang.org/) configuration, including TypeScript and Angular template compiler options. See [TypeScript Configuration](guide/typescript-configuration). |
| `tsconfig.app.json` | Application-specific [TypeScript](https://www.typescriptlang.org/) configuration, including TypeScript and Angular template compiler options. See [TypeScript Configuration](guide/typescript-configuration) and [Angular Compiler Options](guide/angular-compiler-options). |
| `tsconfig.spec.json` | [TypeScript](https://www.typescriptlang.org/) configuration for the application tests. See [TypeScript Configuration](guide/typescript-configuration). |
| `tslint.json` | Application-specific [TSLint](https://palantir.github.io/tslint/) configuration. |

View File

@ -67,11 +67,9 @@ Here's a component with an input field for a single control implemented using re
The source of truth provides the value and status of the form element at a given point in time. In reactive forms, the form model is the source of truth. In the example above, the form model is the `FormControl` instance.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/key-diff-reactive-forms.png" alt="Reactive forms key differences">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/key-diff-reactive-forms.png" alt="Reactive forms key differences">
</div>
With reactive forms, the form model is explicitly defined in the component class. The reactive form directive (in this case, `FormControlDirective`) then links the existing `FormControl` instance to a specific form element in the view using a value accessor (`ControlValueAccessor` instance).
@ -84,11 +82,9 @@ Here's the same component with an input field for a single control implemented u
In template-driven forms, the source of truth is the template.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/key-diff-td-forms.png" alt="Template-driven forms key differences">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/key-diff-td-forms.png" alt="Template-driven forms key differences">
</div>
The abstraction of the form model promotes simplicity over structure. The template-driven form directive `NgModel` is responsible for creating and managing the `FormControl` instance for a given form element. It's less explicit, but you no longer have direct control over the form model.
@ -102,11 +98,9 @@ When building forms in Angular, it's important to understand how the framework h
As described above, in reactive forms each form element in the view is directly linked to a form model (`FormControl` instance). Updates from the view to the model and from the model to the view are synchronous and aren't dependent on the UI rendered. The diagrams below use the same favorite color example to demonstrate how data flows when an input field's value is changed from the view and then from the model.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/dataflow-reactive-forms-vtm.png" alt="Reactive forms data flow - view to model" width="100%">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/dataflow-reactive-forms-vtm.png" alt="Reactive forms data flow - view to model" width="100%">
</div>
The steps below outline the data flow from view to model.
@ -116,11 +110,9 @@ The steps below outline the data flow from view to model.
1. The `FormControl` instance emits the new value through the `valueChanges` observable.
1. Any subscribers to the `valueChanges` observable receive the new value.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/dataflow-reactive-forms-mtv.png" alt="Reactive forms data flow - model to view" width="100%">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/dataflow-reactive-forms-mtv.png" alt="Reactive forms data flow - model to view" width="100%">
</div>
The steps below outline the data flow from model to view.
@ -133,11 +125,9 @@ The steps below outline the data flow from model to view.
In template-driven forms, each form element is linked to a directive that manages the form model internally. The diagrams below use the same favorite color example to demonstrate how data flows when an input field's value is changed from the view and then from the model.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/dataflow-td-forms-vtm.png" alt="Template-driven forms data flow - view to model" width="100%">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/dataflow-td-forms-vtm.png" alt="Template-driven forms data flow - view to model" width="100%">
</div>
The steps below outline the data flow from view to model when the input value changes from *Red* to *Blue*.
@ -150,11 +140,9 @@ The steps below outline the data flow from view to model when the input value ch
1. Because the component template uses two-way data binding for the `favoriteColor` property, the `favoriteColor` property in the component
is updated to the value emitted by the `ngModelChange` event (*Blue*).
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms-overview/dataflow-td-forms-mtv.png" alt="Template-driven forms data flow - model to view" width="100%">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms-overview/dataflow-td-forms-mtv.png" alt="Template-driven forms data flow - model to view" width="100%">
</div>
The steps below outline the data flow from model to view when the `favoriteColor` changes from *Blue* to *Red*.

View File

@ -45,11 +45,9 @@ otherwise wrestle with yourself.
You'll learn to build a template-driven form that looks like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/hero-form-1.png" alt="Clean Form">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/hero-form-1.png" alt="Clean Form">
</div>
The *Hero Employment Agency* uses this form to maintain personal information about heroes.
Every hero needs a job. It's the company mission to match the right hero with the right crisis.
@ -58,11 +56,9 @@ Two of the three fields on this form are required. Required fields have a green
If you delete the hero name, the form displays a validation error in an attention-grabbing style:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/hero-form-2.png" alt="Invalid, Name Required">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/hero-form-2.png" alt="Invalid, Name Required">
</div>
Note that the *Submit* button is disabled, and the "required" bar to the left of the input control changes from green to red.
@ -276,11 +272,9 @@ you display its name using the interpolation syntax.
Running the app right now would be disappointing.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/hero-form-3.png" alt="Early form with no binding">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/hero-form-3.png" alt="Early form with no binding">
</div>
You don't see hero data because you're not binding to the `Hero` yet.
@ -341,11 +335,9 @@ adding and deleting characters, you'd see them appear and disappear
from the interpolated text.
At some point it might look like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/ng-model-in-action.png" alt="ngModel in action">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/ng-model-in-action.png" alt="ngModel in action">
</div>
The diagnostic is evidence that values really are flowing from the input box to the model and
back again.
@ -391,11 +383,9 @@ After revision, the core of the form should look like this:
If you run the app now and change every hero model property, the form might display like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/ng-model-in-action-2.png" alt="ngModel in action">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/ng-model-in-action-2.png" alt="ngModel in action">
</div>
The diagnostic near the top of the form
confirms that all of your changes are reflected in the model.
@ -493,19 +483,15 @@ Follow these steps *precisely*:
The actions and effects are as follows:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/control-state-transitions-anim.gif" alt="Control State Transition">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/control-state-transitions-anim.gif" alt="Control State Transition">
</div>
You should see the following transitions and class names:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/ng-control-class-changes.png" alt="Control state transitions">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/ng-control-class-changes.png" alt="Control state transitions">
</div>
The `ng-valid`/`ng-invalid` pair is the most interesting, because you want to send a
strong visual signal when the values are invalid. You also want to mark required fields.
@ -518,11 +504,9 @@ To create such visual feedback, add definitions for the `ng-*` CSS classes.
You can mark required fields and invalid data at the same time with a colored bar
on the left of the input box:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/validity-required-indicator.png" alt="Invalid Form">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/validity-required-indicator.png" alt="Invalid Form">
</div>
You achieve this effect by adding these class definitions to a new `forms.css` file
that you add to the project as a sibling to `index.html`:
@ -541,11 +525,9 @@ Leverage the control's state to reveal a helpful message.
When the user deletes the name, the form should look like this:
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/forms/name-required-error.png" alt="Name required">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/forms/name-required-error.png" alt="Name required">
</div>
To achieve this effect, extend the `<input>` tag with the following:

View File

@ -111,11 +111,9 @@ directives in `CommonModule`; they dont need to re-install app-wide providers
If you do import `BrowserModule` into a lazy loaded feature module,
Angular returns an error telling you to use `CommonModule` instead.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/frequent-ngmodules/browser-module-error.gif" width=750 alt="BrowserModule error">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/frequent-ngmodules/browser-module-error.gif" width=750 alt="BrowserModule error">
</div>
<hr />

View File

@ -144,6 +144,23 @@ For example, "convert_link_mode".
* UPPER_UNDERSCORE_CASE (or UPPER_SNAKE_CASE, or SCREAMING_SNAKE_CASE): Traditional for constants (acceptable, but prefer camelCase).
Upper snake case uses words in all capital letters connected with underscores. For example, "FIX_ME".
{@a change-detection}
## change detection
The mechanism by which the Angular framework synchronizes the state of an application's UI with the state of the data.
The change detector checks the current state of the data model whenever it runs, and maintains it as the previous state to compare on the next iteration.
As the application logic updates component data, values that are bound to DOM properties in the view can change.
The change detector is responsible for updating the view to reflect the current data model.
Similarly, the user can interact with the UI, causing events that change the state of the data model.
These events can trigger change detection.
Using the default ("CheckAlways") change-detection strategy, the change detector goes through the [view hierarchy](#view-tree) on each VM turn to check every [data-bound property](#data-binding) in the template. In the first phase, it compares the current state of the dependent data with the previous state, and collects changes.
In the second phase, it updates the page DOM to reflect any new data values.
If you set the `OnPush` ("CheckOnce") change-detection strategy, the change detector runs only when [explicitly invoked] (api/core/ChangeDetectorRef), or when it is triggered by an `Input` reference change or event handler. This typically improves performance. For more information, see [Optimize Angular's change detection](https://web.dev/faster-angular-change-detection/).
{@a class-decorator}
## class decorator
@ -938,7 +955,7 @@ View hierarchies can be loaded and unloaded dynamically as the user navigates th
## view hierarchy
A tree of related views that can be acted on as a unit. The root view is a component's *host view*. A host view can be the root of a tree of *embedded views*, collected in a *view container* (`ViewContainerRef`) attached to an anchor element in the hosting component. The view hierarchy is a key part of Angular change detection.
A tree of related views that can be acted on as a unit. The root view is a component's *host view*. A host view can be the root of a tree of *embedded views*, collected in a *view container* (`ViewContainerRef`) attached to an anchor element in the hosting component. The view hierarchy is a key part of Angular [change detection](#change-detection).
The view hierarchy doesn't imply a component hierarchy. Views that are embedded in the context of a particular hierarchy can be host views of other components. Those components can be in the same NgModule as the hosting component, or belong to other NgModules.

View File

@ -108,11 +108,9 @@ The following diagram represents the relationship between the
`root` `ModuleInjector` and its parent injectors as the
previous paragraphs describe.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection/injectors.svg" alt="NullInjector, ModuleInjector, root injector">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection/injectors.svg" alt="NullInjector, ModuleInjector, root injector">
</div>
While the name `root` is a special alias, other `ModuleInjector`s
don't have aliases. You have the option to create `ModuleInjector`s
@ -245,7 +243,7 @@ By default, Angular always starts at the current `Injector` and keeps
searching all the way up. Modifiers allow you to change the starting
(self) or ending location.
Additionally, you can combine all of the modifiers except `@Host()` and `@Self()` and of course `@Skipself()` and `@Self()`.
Additionally, you can combine all of the modifiers except `@Host()` and `@Self()` and of course `@SkipSelf()` and `@Self()`.
{@a optional}
@ -1098,12 +1096,9 @@ Each tax return component has the following characteristics:
* Can change a tax return without affecting a return in another component.
* Has the ability to save the changes to its tax return or cancel them.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection/hid-heroes-anim.gif" alt="Heroes in action">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection/hid-heroes-anim.gif" alt="Heroes in action">
</div>
Suppose that the `HeroTaxReturnComponent` had logic to manage and restore changes.
That would be a pretty easy task for a simple hero tax return.
@ -1172,11 +1167,9 @@ that have special capabilities suitable for whatever is going on in component (B
Component (B) is the parent of another component (C) that defines its own, even _more specialized_ provider for `CarService`.
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection/car-components.png" alt="car components">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection/car-components.png" alt="car components">
</div>
Behind the scenes, each component sets up its own injector with zero, one, or more providers defined for that component itself.
@ -1185,11 +1178,9 @@ its injector produces an instance of `Car` resolved by injector (C) with an `Eng
`Tires` resolved by the root injector (A).
<figure class="lightbox">
<div class="card">
<img src="generated/images/guide/dependency-injection/injector-tree.png" alt="car injector tree">
</div>
</figure>
<div class="lightbox">
<img src="generated/images/guide/dependency-injection/injector-tree.png" alt="car injector tree">
</div>
<hr />

View File

@ -170,7 +170,7 @@ As you can see, the response object has a `body` property of the correct type.
### Making a JSONP request
Apps can use the the `HttpClient` to make [JSONP](https://en.wikipedia.org/wiki/JSONP) requests across domains when the server doesn't support [CORS protocol](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
Apps can use the `HttpClient` to make [JSONP](https://en.wikipedia.org/wiki/JSONP) requests across domains when the server doesn't support [CORS protocol](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS).
Angular JSONP requests return an `Observable`.
Follow the pattern for subscribing to observables and use the RxJS `map` operator to transform the response before using the [async pipe](api/common/AsyncPipe) to manage the results.
@ -951,7 +951,7 @@ by returning an observable of simulated events.
## Security: XSRF protection
[Cross-Site Request Forgery (XSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by which the attacker can trick an authenticated user into unknowingly executing actions on your website.
[Cross-Site Request Forgery (XSRF or CSRF)](https://en.wikipedia.org/wiki/Cross-site_request_forgery) is an attack technique by which the attacker can trick an authenticated user into unknowingly executing actions on your website.
`HttpClient` supports a [common mechanism](https://en.wikipedia.org/wiki/Cross-site_request_forgery#Cookie-to-Header_Token) used to prevent XSRF attacks.
When performing HTTP requests, an interceptor reads a token from a cookie, by default `XSRF-TOKEN`, and sets it as an HTTP header, `X-XSRF-TOKEN`.
Since only code that runs on your domain could read the cookie, the backend can be certain that the HTTP request came from your client application and not an attacker.

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