Bug Fixes
- compiler: ensure that i18n message-parts have the correct source-span (#39486) (63f9e16)
- compiler: skipping leading whitespace should not break placeholder source-spans (#39486) (b8e9b3d), closes #39195
- compiler-cli: avoid duplicate diagnostics about unknown pipes (#39517) (c68ca49)
- compiler-cli: do not drop non-Angular decorators when downleveling (#39577) (f51cf29), closes #39574
- core: Access injected parent values using SelfSkip (#39464) (7cb9e19)
- elements: update the view of an
OnPush
component when inputs change (#39452) (dd28855), closes /github.com/angular/angular/blob/3236ae0ee118d0734c90fa9f3767435396213470/packages/upgrade/src/common/src/downgrade_component_adapter.ts#L146 #38948 - common: change the week-numbering year format from
r
->Y
(#39495) (feda78e) - compiler: preserve this.$event and this.$any accesses in expressions (#39323) (a8e0db7), closes #30278
- compiler-cli: generating invalid setClassMetadata call in ES5 for class with custom decorator (#39527) (b0bbc1f), closes #39509
- compiler-cli: report missing pipes when
fullTemplateTypeCheck
is disabled (#39320) (67ea7b6), closes #38195 - core: markDirty() should only mark flags when really scheduling tick. (#39316) (3b6497b), closes #39296
- forms: remove validators while cleaning up a control (#39234) (43b4940)
- router: Ensure all outlets are used when commands have a prefix (#39456) (b2f3952)
- bazel: only providing stamping information if the –stamp flag is used (#39392) (84e09a0)
- compiler: do not throw away render3 AST on errors (#39413) (d76beda)
- compiler: treat i18n attributes with no bindings as static attributes (#39408) (bf1caa7), closes #38231
- core: do not error when
ngDevMode
is undeclared (#39415) (cc32932) - core: Store ICU state in
LView
rather than inTView
(#39233) (0992b67), closes #37021 #38144 #38073 - core: update expected size for cli-hello-world-ivy-i18n integration test (#39402) (084b082)
- localize: render placeholder types in extracted XLIFF files (#39398) (32163ef), closes #38791
- localize: serialize all the message locations to XLIFF (#39411) (f5710c6), closes #39330
- ngcc: capture UMD/CommonJS inner class implementation node correctly (#39346) (fc2e3cc)
- common: update locales using new CLDR data (#39343) (3738233)
- compiler: promote constants in templates to Trusted Types (#39211) (6e18d2d)
- core: guard reading of global
ngDevMode
for undefined. (#36055) (f541e5f) - language-service: [Ivy] create compiler only when program changes (#39231) (8f1317f)
- ngcc: ensure that “inline exports” can be interpreted correctly (#39267) (822b838)
- platform-server: Resolve absolute URL from baseUrl (#39334) (b4e8399)
- router: incorrect signature for createUrlTree (#39347) (161b278)
- compiler-cli: type checking of expressions within ICUs (#39072) (0a16e60), closes #39064
- core: migrate relative link resolution with single quotes (#39102) (049b453), closes #39082
- core: use Trusted Types policy in inert DOM builder (#39208) (7d49299)
- core: use Trusted Types policy in named_array_type (#39209) (f6d5cdf)
- router: Allow undefined inputs on routerLink (#39151) (b0b4953)
- router: create schematic for preserveQueryParams (#38762) (93ee05d)
- router: remove preserveQueryParams symbol (#38762) (783a5bd)
- common: add boolean to valid json for testing (#37893) (3c474ec), closes #20690
- core: use single quotes for relative link resolution migration to align with style guide (#39070) (8894706)
- forms: improve types of directive constructor arguments (#38944) (246de9a)
- forms: include null in .parent of abstract control (#32671) (f4f1bcc), closes #16999
- language-service: [Ivy] hybrid visitor should not locate let keyword (#39061) (70e13dc)
- router: properly assign ExtraOptions to Router in RouterTestingModule (#39096) (d8c0534), closes #23347
- common: correct and simplify typing of
KeyValuePipe
(#37447) (4dfe0fa) - common: correct and simplify typing of AsyncPipe (#37447) (5f815c0)
- common: correct and simplify typing of I18nPluralPipe (#37447) (3b919ef)
- common: correct typing and implementation of
SlicePipe
(#37447) (4744c22) - common: let case conversion pipes accept type unions with
null
(#36259) (#37447) (c7d5555) - compiler-cli: perform DOM schema checks even in basic mode in g3 (#38943) (40975e0)
- language-service: hybrid visitor returns parent node of BoundAttribute (#38995) (323be39)
- packaging: remove polyfills needed to run tests on IE9 and IE 10 (#38931) (4ca1c73)
- platform-webworker: remove platform-webworker and platform-webworker-dynamic (#38846) (93c3d8f)
- router: make relativeLinkResolution corrected by default (#25609) (837889f), closes #22394
- common: add
params
andreportProgress
options toHttpClient.put()
overload (#37873) (dd8d8c8), closes #23600 - compiler-cli: generate
let
statements in ES2015+ mode (#38775) (123bff7) - core: ensure TestBed is not instantiated before override provider (#38717) (c8f056b)
- forms: type NG_VALUE_ACCESSOR injection token as array (#29723) (2b1b718), closes #29351
- common: do not round up fractions of a millisecond in
DatePipe
(#38009) (26f2820), closes /www.ecma-international.org/ecma-262/5.1/#sec-15 #37989 - common: mark locale data arrays as readonly (#30397) (6acea54), closes #27003
- compiler: source span for microsyntax text att should be key span (#38766) (8f349b2)
- router: Fix arguments order for call to shouldReuseRoute (#26949) (3817e5f), closes #16192 #16192
- compiler-cli: compute source-mappings for localized strings (#38645) (7e0b3fd), closes #38588
- core: remove CollectionChangeRecord symbol (#38668) (fdea180)
- router: support lazy loading for empty path named outlets (#38379) (926ffcd), closes #12842
- forms: ensure to emit
statusChanges
on subsequent value update/validations (#38354) (d9fea85), closes #20424 #14542 - service-worker: fix condition to check for a cache-busted request (#36847) (5be4edf)
Features
- core: add automated migration to replace async with waitForAsync (#39212) (5ce71e0)
- core: add automated migration to replace ViewEncapsulation.Native (#38882) (0e733f3)
- core: add initialNavigation schematic (#36926) (0ec7043)
- core: add Trusted Types workaround for Function constructor (#39209) (5913e5c)
- core: create internal Trusted Types module (#39207) (0875fd2)
- core: depend on type definitions for Trusted Types (#39207) (c4266fb)
- core: remove ViewEncapsulation.Native (#38882) (4a1c12c)
- language-service: [Ivy] getSemanticDiagnostics for external templates (#39065) (63624a2)
- language-service: Add getTypeDefinitionAtPosition (go to type definition) (#39145) (a84976f)
- language-service: Add module name to directive quick info (#39121) (4604fe9)
- router: add new initialNavigation options to replace legacy (#37480) (c4becca)
- compiler-cli: support getting resource dependencies for a source file (#38048) (5dbf357)
- forms: add migration for AbstractControl.parent accesses (#39009) (aeec223), closes #32671
- language-service: Add getDefinitionAndBoundSpan (go to definition) (#39101) (3975dd9)
- language-service: add quick info for inline templates in ivy (#39060) (904adb7)
- common: stricter types for DatePipe (#37447) (daf8b7f)
- common: stricter types for number pipes (#37447) (7b2aac9)
- compiler: Add keySpan to Variable Node (#38965) (239968d)
- router: Add
relativeLinkResolution
migration to update default value (#38698) (15ea811) - common: Add ISO week-numbering year formats support to formatDate (#38828) (984ed39)
- compiler: Parse and recover on incomplete opening HTML tags (#38681) (6ae3b68), closes #38596
- router: add migration to update calls to navigateByUrl and createUrlTree with invalid parameters (#38825) (7849fdd), closes #38227
- service-worker: add the option to prefer network for navigation requests (#38565) (a206852), closes #38194
- compiler-cli:
TemplateTypeChecker
operation to getSymbol
from a template node (#38618) (c4556db) - compiler-cli: Add ability to get
Symbol
ofTemplate
s andElement
s in component template (#38618) (cf2e8b9) - compiler-cli: Add ability to get
Symbol
of AST expression in component template (#38618) (f56ece4) - compiler-cli: add ability to get symbol of reference or variable (#38618) (19598b4)
- compiler-cli: define interfaces to be used for TemplateTypeChecker (#38618) (9e77bd3)
- service-worker: add
UnrecoverableStateError
(#36847) (036a2fa), closes #36539
Performance Improvements
- compiler-cli: only generate template context declaration when used (#39321) (1ac0500)
- core: do not recurse into modules that have already been registered (#39514) (5c13c67), closes #39487
- compiler-cli: only emit directive/pipe references that are used (#38539) (077f516)
- compiler-cli: optimize computation of type-check scope information (#38539) (297c060)
- router: use
ngDevMode
to tree-shake error messages in router (#38674) (db21c4f)
BREAKING CHANGES
- platform-server: If you use
useAbsoluteUrl
to setupplatform-server
, you now need to also specifybaseUrl
. We are intentionally making this a breaking change in a minor release, because ifuseAbsoluteUrl
is set totrue
then the behavior of the application could be unpredictable, resulting in issues that are hard to discover but could be affecting production environments. - compiler: TypeScript 3.9 is no longer supported, please upgrade to TypeScript 4.0.
- router: * The
initialNavigation
property for the options inRouterModule.forRoot
no longer supportslegacy_disabled
,legacy_enabled
,true
, orfalse
as valid values.legacy_enabled
(the old default) is insteadenabledNonBlocking
enabled
is deprecated as a valid value for theRouterModule.forRoot
initialNavigation
option.enabledBlocking
has been introduced to replace it- router: preserveQueryParams has been removed, use queryParamsHandling=”preserve” instead
- router: If you were accessing the
RouterLink
values ofqueryParams
,fragment
orqueryParamsHandling
you might need to relax the typing to also acceptundefined
andnull
. (#39151) - core: *
ViewEncapsulation.Native
has been removed. UseViewEncapsulation.ShadowDom
instead. Existing usages will be updated automatically byng update
. - compiler-cli: Expressions within ICUs are now type-checked again, fixing a regression in Ivy. This may cause compilation failures if errors are found in expressions that appear within an ICU. Please correct these expressions to resolve the type-check errors.
- forms: Directives in the
@angular/forms
package used to haveany[]
as a type ofvalidators
andasyncValidators
arguments in constructors. Now these arguments are properly typed, so if your code relies on directive constructor types it may require some updates to improve type safety. - forms: Type of AbstractFormControl.parent now includes null.
null
is now included in the types of .parent. If you don’t already have a check for this case, the TypeScript compiler might complain. A v11 migration exists which adds the non-null assertion operator where necessary. In an unlikely case your code was testing the parent against undefined with strict equality, you’ll need to change this to=== null
instead, since the parent is now explicitly initialized withnull
instead of being leftundefined
. - packaging: In v10, IE 9, 10, and IE mobile support was deprecated. In v11, Angular framework removes IE 9, 10, and IE mobile support completely. Supporting outdated browsers like these increases bundle size, code complexity, and test load, and also requires time and effort that could be spent on improvements to the framework. For example, fixing issues can be more difficult, as a straightforward fix for modern browsers could break old ones that have quirks due to not receiving updates from vendors.
- platform-webworker: @angular/platform-webworker and @angular/platform-webworker-dynamic have been removed as they were deprecated in v8
- common: The
slice
pipe now returnsnull
for theundefined
input value, which is consistent with the behavior of most pipes. If you rely onundefined
being the result in that case, you now need to check for it explicitly. - common: The typing of the
keyvalue
pipe has been fixed to report that for input objects that havenumber
keys, the result will contain the string representation of the keys. This was already the case and the code has simply been updated to reflect this. Please update the consumers of the pipe output if they were relying on the incorrect types. Note that this does not affect use cases where the input values areMap
s, so if you need to preservenumber
s, this is an effective way. - common: The signatures of the number pipes now explicitly state which types are accepted. This should only cause issues in corner cases, as any other values would result in runtime exceptions.
- common: The signature of the
date
pipe now explicitly states which types are accepted. This should only cause issues in corner cases, as any other values would result in runtime exceptions. - common: The async pipe no longer claims to return
undefined
for an input that was typed asundefined
. Note that the code actually returnednull
onundefined
inputs. In the unlikely case you were relying on this, please fix the typing of the consumers of the pipe output. - common: The case conversion pipes no longer let falsy values through. They now map both
null
andundefined
tonull
and raise an exception on invalid input (0
,false
,NaN
) just like most “common pipes”. If your code required falsy values to pass through, you need to handle them explicitly. - router: While the new parameter types allow a variable of type
NavigationExtras
to be passed in, they will not allow object literals, as they may only specify known properties. They will also not accept types that do not have properties in common with the ones in thePick
. To fix this error, only specify properties from theNavigationExtras
which are actually used in the respective function calls or use a type assertion on the object or variable:as NavigationExtras
. - router: This commit changes the default value of
relativeLinkResolution
from'legacy'
to'default'
. If your application previously used the default by not specifying a value in theExtraOptions
and uses relative links when navigating from children of empty path routes, you will need to update yourRouterModule
to specifically specify'legacy'
forrelativeLinkResolution
. See https://angular.io/api/router/ExtraOptions#relativeLinkResolution for more details. - core: If you call
TestBed.overrideProvider
after TestBed initialization, provider overrides are not applied. This behavior is consistent with other override methods (such asTestBed.overrideDirective
, etc) but they throw an error to indicate that, when the check was missing in theTestBed.overrideProvider
function. Now callingTestBed.overrideProvider
after TestBed initialization also triggers an error, thus there is a chance that some tests (whereTestBed.overrideProvider
is called after TestBed initialization) will start to fail and require updates to moveTestBed.overrideProvider
calls before TestBed initialization is completed. - router: This change corrects the argument order when calling RouteReuseStrategy#shouldReuseRoute. Previously, when evaluating child routes, they would be called with the future and current arguments would be swapped. If your RouteReuseStrategy relies specifically on only the future or current snapshot state, you may need to update the shouldReuseRoute implementation’s use of “future” and “current” ActivateRouteSnapshots.
- common: The locale data API has been marked as returning readonly arrays, rather than mutable arrays, since these arrays are shared across calls to the API. If you were mutating them (e.g. calling
sort()
,push()
,splice()
, etc) then your code will not longer compile. If you need to mutate the array, you should now take a copy (e.g. by callingslice()
) and mutate the copy. - common: When passing a date-time formatted string to the
DatePipe
in a format that contains fractions of a millisecond, the milliseconds will now always be rounded down rather than to the nearest millisecond. Most applications will not be affected by this change. If this is not the desired behaviour then consider pre-processing the string to round the millisecond part before passing it to theDatePipe
. - core: CollectionChangeRecord has been removed, use IterableChangeRecord instead
- forms: Previously if FormControl, FormGroup and FormArray class instances had async validators defined at initialization time, the status change event was not emitted once async validator completed. After this change the status event is emitted into the
statusChanges
observable. If your code relies on the old behavior, you can filter/ignore this additional status change event.
Code Refactoring
- compiler: remove support for TypeScript 3.9 (#39313) (736e064)
- router: Adjust type of parameter in navigateByUrl and createUrlTree to be more accurate (#38227) (e4f4d18), closes #18798
转自 https://github.com/angular/angular/blob/master/CHANGELOG.md