The wait is over: after nine release candidate over a month and half, the Final Release of Angular 5.0.0, codename Pentagonal Donut, is finally out! The new version brings a lot of new features, performance improvements and (sadly) breaking changes since v4, but we're surely going to love it after all this wait.
Here's the full cumulative 5.x changelog, as it was released on the Angular official GitHub repository few hours ago: for further info regarding the previous release candidates, feel free to check this post (RC1 to RC7), this other post (RC8) and this last post (RC9) as well!
What more could we say? Just a couple uppercase words:
ABOUT TIME!
:)
5.0.0 pentagonal-donut (2017-11-01)
Features
- animations: allow @.disabled property to work without an expression (#18713) (2159342)
- animations: report errors when invalid CSS properties are detected (#18718) (409688f), closes #18701
- animations: support :increment and :decrement transition aliases (6f45519)
- animations: support negative query limit values (86ffacf), closes #19259
- common: accept object map for HttpClient headers & params (#18490) (1b1d5f1)
- common: add an empty DeprecatedI18NPipesModule module (#18737) (83713dd)
- common: drop use of the Intl API to improve browser support (#18284) (079d884), closes #10809 #9524 #7008 #9324#7590 #6724 #3429 #17576 #17478 #17319 #17200 #16838 #16624 #16625 #16591 #14131 #12632 #11376 #11187
- common: generate
closure-locale.ts
to tree shake locale data (#18907) (4878936) - common: mark NgTemplateOutlet API as stable (0a73e8d)
- compiler-cli: add watch mode to
ngc
(#18818) (06d01b2) - compiler-cli: lower metadata
useValue
anddata
literal fields (#18905) (0e64261) - compiler: add representation of placeholders to xliff & xmb (b3085e9), closes #17345
- compiler: allow multiple exportAs names (#18723) (7ec28fe)
- compiler: deprecate i18n comments in favor of
ng-container
(#18998) (66a5dab) - compiler: enabled strict checking of parameters to an
@Injectable
(#19412) (dfb8d21) - compiler: make
.ngsummary.json
files portable (2572bf5) - compiler: reuse the TypeScript typecheck for template typechecking. (#19152) (996c7c2)
- compiler: set
enableLegacyTemplate
to false by default (#18756) (56238fe) - compiler: use typescript for resolving resource paths (43226cb)
- core: Create StaticInjector which does not depend on Reflect polyfill. (d9d00bd)
- core: add option to remove blank text nodes from compiled templates (#18823) (b8b551c)
- core: support for bootstrap with custom zone (#17672) (344a5ca)
- forms: add default updateOn values for groups and arrays (#18536) (ff5c58b)
- forms: add options arg to abstract controls (ebef5e6)
- forms: add status to
AbstractControlDirective
(233ef93) - forms: add updateOn and ngFormOptions to NgForm (0d45828)
- forms: add updateOn blur option to FormControls (#18408) (333a708), closes #7113
- forms: add updateOn submit option to FormControls (#18514) (f69561b)
- forms: add updateOn support to ngModelOptions (1cfa79c)
- http: deprecate @angular/http in favor of @angular/common/http (#18906) (72c7b6e)
- platform-server: add an API to transfer state from server (#19134) (cfd9ca0)
- platform-server: provide a DOM implementation on the server (2f2d5f3), closes #14638
- platform-server: provide a way to hook into renderModule* (#19023) (8dfc3c3)
- router: add ActivationStart/End events (8f79150)
- router: add events tracking activation of individual routes (49cd851)
- service-worker: introduce the @angular/service-worker package (#19274) (d442b68)
- upgrade: propagate touched state of NgModelController (59c23c7)
- upgrade: support lazy-loading Angular module into AngularJS app (30e76fc)
- update angular to support TypeScript 2.4 (ca5aeba)
Performance Improvements
- animations: reduce size of bundle by removing AST classes (#19539) (d5c9c5f)
- compiler: don’t emit summaries for jit by default (b086891)
- compiler: fix perf issue in loading aot summaries in jit compiler (fbc9537)
- compiler: make the creation of
ts.Program
faster. (#19275) (edd5f5a) - compiler: only emit changed files for incremental compilation (745b59f)
- compiler: only type check input files when using bazel (#19581) (0b06ea1)
- compiler: only use tsickle if needed (#19275) (8f95b75)
- compiler: skip type check and emit in bazel in some cases. (#19646) (a22121d)
- compiler: speed up loading of summaries for bazel. (#19581) (81167d9)
- compiler: speed up watch mode (#19275) (6665d76)
- core: Remove decorator DSL which depends on Reflect (cac130e)
- core: add option to remove blank text nodes from compiled templates (d2c0d98)
- core: use native addEventListener for faster rendering. (#18107) (6279e50)
- latest tsickle to tree shake: abstract class methods & interfaces (#18236) (b7a6f52)
- switch angular to use StaticInjector instead of ReflectiveInjector (fcadbf4), closes #18496
BREAKING CHANGES
- compiler: The method
ngGetContentSelectors()
, deprecated in Angular 4.0, has been removed. UseComponentFactory.ngContentSelectors
instead. -
- the Angular compiler now requires TypeScript 2.4.x.
- router:
RouterOutlet
propertieslocationInjector
andlocationFactoryResolver
have been removed as they were deprecated since v4. - compiler: the compiler option
enableLegacyTemplate
is now disabled by default as the<template>
element has been deprecated since v4. Use<ng-template>
instead. The optionenableLegacyTemplate
and the<template>
element will both be removed in Angular v6. - core:
OpaqueToken
has been removed as it was deprecated since v4. UseInjectionToken
instead. platformXXXX()
no longer accepts providers which depend on reflection. Specifically the method signature when fromProvider[]
toStaticProvider[]
.
Example: Before:
1 2 3 4 5 6 |
[ MyClass, {provide: ClassA, useClass: SubClassA} ] |
After:
1 2 3 4 5 |
[ {provide: MyClass, deps: [Dep1,...]}, {provide: ClassA, useClass: SubClassA, deps: [Dep1,...]} ] |
NOTE: This only applies to platform creation and providers for the JIT compiler. It does not apply to @Component
or @NgModule
provides declarations.
Benchpress note: Previously Benchpress also supported reflective provides, which now require static providers.
I18n Changes (@angular/common)
Because of multiple bugs and browser inconsistencies, we have dropped the intl api in favor of data exported from the Unicode Common Locale Data Repository (CLDR). Unfortunately we had to change the i18n pipes (date, number, currency, percent) and there are some breaking changes.
I18n pipes:
- Breaking change:
- By default Angular now only contains locale data for the language
en-US
, if you set the value ofLOCALE_ID
to another locale, you will have to import new locale data for this language because we don't use the intl API anymore.
- By default Angular now only contains locale data for the language
- Features:
- you don't need to use the intl polyfill for Angular anymore.
- all i18n pipes now have an additional last parameter
locale
which allows you to use a specific locale instead of the one defined in the tokenLOCALE_ID
(whose default value isen-US
). - the new locale data extracted from CLDR are now available to developers as well and can be used through an API (which should be especially useful for library authors).
- you can still use the old pipes for now, but their names have been changed and they are no longer included in the
CommonModule
. To use them, you will have to import theDeprecatedI18NPipesModule
after theCommonModule
(the order is important):
1234567891011<span class="pl-k">import</span> { <span class="pl-smi">NgModule</span> } <span class="pl-k">from</span> <span class="pl-s"><span class="pl-pds">'</span>@angular/core<span class="pl-pds">'</span></span>;<span class="pl-k">import</span> { <span class="pl-smi">CommonModule</span>, <span class="pl-smi">DeprecatedI18NPipesModule</span> } <span class="pl-k">from</span> <span class="pl-s"><span class="pl-pds">'</span>@angular/common<span class="pl-pds">'</span></span>;@<span class="pl-en">NgModule</span>({imports: [<span class="pl-smi">CommonModule</span>,<span class="pl-c">// import deprecated module after</span><span class="pl-smi">DeprecatedI18NPipesModule</span>]})<span class="pl-k">export</span> <span class="pl-k">class</span> <span class="pl-en">AppModule</span> { }Don't forget that you will still need to import the intl API polyfill if you want to use those deprecated pipes.
Date pipe
- Breaking changes:
- the predefined formats (
short
,shortTime
,shortDate
,medium
, ...) now use the patterns given by CLDR (like it was in AngularJS) instead of the ones from the intl API. You might notice some changes, e.g.shortDate
will be8/15/17
instead of8/15/2017
foren-US
. - the narrow version of eras is now
GGGGG
instead ofG
, the formatG
is now similar toGG
andGGG
. - the narrow version of months is now
MMMMM
instead ofL
, the formatL
is now the short standalone version of months. - the narrow version of the week day is now
EEEEE
instead ofE
, the formatE
is now similar toEE
andEEE
. - the timezone
z
will now fallback toO
and outputGMT+1
instead of the complete zone name (e.g.Pacific Standard Time
), this is because the quantity of data required to have all the zone names in all of the existing locales is too big. - the timezone
Z
will now output the ISO8601 basic format, e.g.+0100
, you should now useZZZZ
to getGMT+01:00
.
Field type Format Example value v4 v5 Eras Narrow A for AD G GGGGG Months Narrow S for September L MMMMM Week day Narrow M for Monday E EEEEE Timezone Long location Pacific Standard Time z Not available Timezone Long GMT GMT+01:00 Z ZZZZ - the predefined formats (
- Features
- new predefined formats
long
,full
,longTime
,fullTime
. - the format
yyy
is now supported, e.g. the year52
will be052
and the year2017
will be2017
. - standalone months are now supported with the formats
L
toLLLLL
. - week of the year is now supported with the formats
w
andww
, e.g. weeks5
and05
. - week of the month is now supported with the format
W
, e.g. week3
. - fractional seconds are now supported with the format
S
toSSS
. - day periods for AM/PM now supports additional formats
aa
,aaa
,aaaa
andaaaaa
. The formatsa
toaaa
are similar, whileaaaa
is the wide version if available (e.g.ante meridiem
foram
), or equivalent toa
otherwise, andaaaaa
is the narrow version (e.g.a
foram
). - extra day periods are now supported with the formats
b
tobbbbb
(andB
toBBBBB
for the standalone equivalents), e.g.morning
,noon
,afternoon
, .... - the short non-localized timezones are now available with the format
O
toOOOO
. The formatsO
toOOO
will outputGMT+1
while the formatOOOO
will beGMT+01:00
. - the ISO8601 basic time zones are now available with the formats
Z
toZZZZZ
. The formatsZ
toZZZ
will output+0100
, while the formatZZZZ
will beGMT+01:00
andZZZZZ
will be+01:00
.
- new predefined formats
- Bug fixes
- the date pipe will now work exactly the same across all browsers, which will fix a lot of bugs for safari and IE.
- eras can now be used on their own without the date, e.g. the format
GG
will beAD
instead of8 15, 2017 AD
.
Currency pipe
- Breaking change:
- the default value for
symbolDisplay
is nowsymbol
instead ofcode
. This means that by default you will see$4.99
foren-US
instead ofUSD4.99
previously.
- the default value for
- Deprecation:
- the second parameter of the currency pipe (
symbolDisplay
) is no longer a boolean, it now takes the valuescode
,symbol
orsymbol-narrow
. A boolean value is still valid for now, but it is deprecated and it will print a warning message in the console.
- the second parameter of the currency pipe (
- Features:
- you can now choose between
code
,symbol
orsymbol-narrow
which gives you access to more options for some currencies (e.g. the canadian dollar with the codeCAD
has the symbolCA$
and the symbol-narrow$
).
- you can now choose between
Percent pipe
- Breaking change
- if you don't specify the number of digits to round to, the local format will be used (and it usually rounds numbers to 0 digits, instead of not rounding previously), e.g.
{{ 3.141592 | percent }}
will output314%
for the localeen-US
instead of314.1592%
previously.
- if you don't specify the number of digits to round to, the local format will be used (and it usually rounds numbers to 0 digits, instead of not rounding previously), e.g.
Deprecated code
- router:
RouterOutlet
propertieslocationInjector
andlocationFactoryResolver
have been removed as they were deprecated since v4. - common:
NgFor
has been removed as it was deprecated since v4. UseNgForOf
instead. This does not impact the use of*ngFor
in your templates. - common:
NgTemplateOutlet#ngOutletContext
has been removed as it was deprecated since v4. UseNgTemplateOutlet#ngTemplateOutletContext
instead. - core:
Testability#findBindings
has been removed as it was deprecated since v4. UseTestability#findProviders
instead. - core:
DebugNode#source
has been removed as it was deprecated since v4. - router: the values
true
,false
,legacy_enabled
andlegacy_disabled
for the router parameterinitialNavigation
have been removed as they were deprecated. Useenabled
ordisabled
instead. - core:
DifferFactory.create
no longer takes ChangeDetectionRef as a first argument as it was not used and deprecated since v4. - core:
TrackByFn
has been removed because it was deprecated since v4. UseTrackByFunction
instead. - platform-webworker:
PRIMITIVE
has been removed as it was deprecated since v4. UseSerializerTypes.PRIMITIVE
instead. - platform-browser:
NgProbeToken
has been removed from@angular/platform-browser
as it was deprecated since v4. Import it from@angular/core
instead. - core:
ErrorHandler
no longer takes a parameter as it was not used and deprecated since v4. - compiler: the option
useDebug
for the compiler has been removed as it had no effect and was deprecated since v4. - common: remove deprecated
NgFor
(#18758) (ec56760) - common: remove deprecated
NgTemplateOutlet#ngOutletContext
(#18780) (7522987) - compiler: remove option
useDebug
(#18778) (499d05d) - compiler: split compiler and core (#18683) (0cc77b4)
- compiler: -
@angular/platform-server
now additionally depends on@angular/platform-browser-dynamic
as a peer dependency. - core: remove deprecated
ChangeDetectionRef
argument inDifferFactory#create
(#18757) (be9713c) - core: remove deprecated
DebugNode#source
(#18779) (d61b902) - core: remove deprecated
OpaqueToken
(#18971) (3c4eef8) - core: remove deprecated
Testability#findBindings
(#18782) (f2a2a6b) - core: remove deprecated
TrackByFn
(#18757) (596e9f4) - core: remove deprecated parameter for
ErrorHandler
(#18759) (8f41326) - platform-browser: remove deprecated
NgProbeToken
(#18760) (d7f42bf) - platform-webworker: remove deprecated
PRIMITIVE
(#18761) (a56468c) - router: remove deprecated
RouterOutlet
properties (#18781) (d1c4a94) - router: remove deprecated
RouterOutlet
properties (a9ef858) - router: remove deprecated
initialNavigation
options (#18781) (d76761b)
ReflectiveInjector
is now deprecated as it will be remove. UseInjector.create
as a replacement.