Angular 6 released
Angular 6 released

Now Angular 6 released officially, with Angular CLI 6 and Material 6.

Bug Fixes

Release Highlights & Update instructions

Angular v6 is the first release of Angular that unifies the Framework, Material and CLI.

To learn about the release highlights and our new CLI-powered update workflow for your projects please check out the v6 release announcement.

Dependency updates

  • @angular/core now depends on
    • TypeScript 2.7
    • RxJS 6.0.0
    • tslib 1.9.0
  • @angular/platform-server now depends on Domino 2.0

Small Features

  • animations: only use the WA-polyfill alongside AnimationBuilder (#22143) (b2f366b), closes #17496
  • animations: expose element and params within transition matchers (#22693) (58b94e6)
  • common: better error message when non-template element used in NgIf (#22274) (67cf11d), closes #16410
  • common: better error message when non-template element used in NgIf (#22274) (67cf11d), closes #16410
  • common: export functions to format numbers, percents, currencies & dates (#22423) (4180912), closes #20536
  • compiler: lower @NgModule ids if needed (#23031) (bd024c0)
  • compiler: implement "enableIvy" compiler option (#21427) (64d16de)
  • compiler: mark @NgModules in provider lists for identification at runtime (#22005) (2d5e7d1)
  • compiler: add support for marker tags in xliff serializers (#21250) (f74130c), closes #21078
  • compiler: support for singleline, multiline & jsdoc comments (#22715) (3b167be)
  • compiler-cli: lower loadChildren fields to allow dynamic module paths (#23088) (550433a)
  • compiler-cli: check unvalidated combination of ngc and TypeScript (#22293) (3ceee99), closes #20669
  • compiler-cli: reflect static methods added to classes in metadata (#21926) (eb8ddd2)
  • compiler-cli: Check unvalidated combination of ngc and TypeScript (#22293) (3ceee99), closes #20669
  • compiler-cli: add resource inlining to ngc (#22615) (b5be18f)
  • compiler-cli: require node 8 as runtime engine (#22669) (c602563)
  • core: add binding name to content changed error (#20352) (d3bf54b)
  • core: optional generic type for ElementRef (#20765) (d3d9aac), closes #13139
  • core: set preserveWhitespaces to false by default (#22046) (f1a0632), closes #22027
  • core: support metadata reflection for native class types (#22356) (5c89d6b), closes #21731
  • core: change @Injectable() to support tree-shakeable tokens (#22005) (235a235)
  • core: support metadata reflection for native class types (#22356) (b7544cc), closes #21731
  • core: allow direct scoping of @Injectables to the root injector (#22185) (7ac34e4)
  • core: add task tracking to Testability (#16863) (37fedd0)
  • forms: handle string with and without line boundary on pattern validator (#19256) (54bf179)
  • forms: multiple validators for array method (#20766) (941e88f), closes #20665
  • forms: allow markAsPending to emit events (#20212) (e86b64b), closes #17958
  • platform-browser: add token marking which the type of animation module nearest in the injector tree (#23075) (b551f84)
  • platform-browser: do not throw error when Hammer.js not loaded (#22257) (991300b), closes #16992
  • platform-browser: fix #19604, can config hammerOptions (#21979) (1d571b2)
  • platform-server: bump Domino to v2.0 (#22411) (d3827a0)
  • router: add navigationSource and restoredState to NavigationStart event (#21728) (c40ae7f)
  • service-worker: add support for configuring navigations URLs (#23339) (08325aa), closes #20404
  • service-worker: add helper script which will uninstall SW (#21863) (b10540a)

Bug Fixes

  • animations: report correct totalTime value even during noOp animations (#22225) (e1bf067)
  • animations: avoid animation insertions during router back/refresh (#21977) (f88fba0), closes #19712
  • animations: treat numeric state name values as strings (#22923) (e5e1b0d)
  • animations: report correct totalTime value even during noOp animations (#22225) (e1bf067)
  • animations: fix increment/decrement aliases example (#18323) (d2aa8ac)
  • common: NgClass should properly take className changes into account (#21937) (4a42669), closes #21932
  • common: fix the titlecase pipe (#22600) (7966744)
  • common: add locale currency values (#21783) (420cc7a), closes #20385
  • common: round currencies based on decimal digits in CurrencyPipe (#21783) (44154e7), closes #10189
  • common: weaken AsyncPipe transform signature (#22169) (be59c3a)
  • common: http testing library should not convert null to a string when flushing a mock request (#21417) (8b14488), closes #20744
  • common: correct mapping of Observable methods (#20518) (2639b4b), closes #20516
  • common: then and else template might be set to null (#22298) (8115edc)
  • common: A null value should remove the style on IE (#21679) (7d49443), closes #21064
  • common: fallback to last defined value for named date and time formats (#21299) (879756d), closes #21282
  • common: set correct timezone for ISO8601 dates in Safari (#21506) (05208b8), closes #21491
  • compiler: fix ICU select messages to use male/female/other (#21713) (cb5090c)
  • compiler: avoid a crash in ngc-wrapped. (#23468) (0bc8443)
  • compiler: handle undefined annotation metadata (#23349) (b9431e8)
  • compiler: don't typecheck all inputs (#22899) (838a610)
  • compiler: fix support for html-like text in translatable attributes (#23053) (28058b7)
  • compiler: take quoting into account when determining if object literals can be shared (#22942) (d98e9e7)
  • compiler: do not emit line/char in ngsummary files. (#22840) (5c387a7)
  • compiler: make unary plus operator consistent to JavaScript (#22154) (72f8abd), closes #22089
  • compiler: allow tree-shakeable injectables to depend on string tokens (#22376) (dd53447)
  • compiler: don't strip /*# sourceURL ... */ (#16088) (5f681f9)
  • compiler: cache external reference resolution (#21359) (e3e2fc0)
  • compiler: make .ngsummary.json files idempotent (#21448) (e64b1e9)
  • compiler-cli: shorten resolved module name in fileNameToModuleName to npm package name for typings (#23231) (6199ea5)
  • compiler-cli: strictMetadataEmit should not break on non-compliant libraries (#23275) (5814355), closes #22210
  • compiler-cli: flat module index metadata should be transformed (#23129) (f99cb5c)
  • compiler-cli: use numeric comparison for TypeScript version (#22705) (193737a), closes #22593
  • compiler-cli: disableTypeScriptVersionCheck should be applied even for older tsc versions (#22669) (3f70aba)
  • compiler-cli: emit correct css string escape sequences (#22776) (6e5e819)
  • compiler-cli: do not fold errors past calls in the collector (#21708) (dd86790)
  • compiler-cli: do not lower expressions in non-modules (#21649) (7f93aad)
  • core: fix #20582, don't need to wrap zone in location change listener (#20640) (f791e9f)
  • core: fix proper propagation of subscriptions in EventEmitter (#22016) (e81606c), closes #21999
  • core: fix chained http call (#20924) (7e3f9a4), closes #20921
  • core: should check Zone existence when scheduleMicroTask (#20656) (3a86940)
  • core: avoid eager providers re-initialization (#23559) (697b6c0)
  • core: add stacktrace in log when error during cleanup component in TestBed (#22162) (16d1700)
  • core: ensure initial value of QueryList length (#21980) (#21982) (e56de10), closes #21980
  • core: use appropriate inert document strategy for Firefox & Safari (#17019) (a751649)
  • core: properly handle function without prototype in reflector (#22284) (a7ebf5a), closes #19978
  • core: require factory to be provided for shakeable InjectionToken (#22207) (f755db7), closes #22205
  • core: remove core animation import symbols (#22692) (f5a98f4)
  • forms: improve error message for invalid value accessors (#22731) (23cc3ef)
  • forms: make Validators.email support optional controls (#20869) (140e7c0)
  • forms: prevent event emission on enable/disable when emitEvent is false (#12366) (#21018) (0bcfae7)
  • forms: set state before emitting a value from ngModelChange (#21514) (9744a1c), closes #21513
  • forms: publish missing types (#19941) (2707012)
  • forms: set state before emitting a value from ngModelChange (#21514) (3e6a86f), closes #21513
  • language-service: Clear caches when program changes (#21337) (43e1520), closes #19405
  • platform-browser: add @Injectable where it was missing (#22005) (0a1a397)
  • platform-browser: support 0/false/null values in transfer_state (#22179) (6435ecd)
  • platform-browser: do not throw error when Hammer.js not loaded (#22257) (991300b), closes #16992
  • platform-browser: fix #19604, can config hammerOptions (#21979) (1d571b2)
  • platform-server: require node v8+ (#23331) (bbfa1d3)
  • platform-server: generate correct stylings for camel case names (#22263) (40ba009), closes #19235
  • platform-server: add styles to elements correctly (#22527) (cd2ebd2)
  • router: cache route handle if found (#22475) (d8de648), closes #22474
  • router: don't use spread operator to workaround an issue in closure compiler (#22884) (e6c731f)
  • router: make locationSyncBootstrapListener public due to change in output after TS 2.7 update in #22669 (#22896) (623d769)
  • router: correct over-encoding of URL fragment (#22687) (0bf6fa5)
  • router: don't mutate route configs (#22358) (45eff4c), closes #22203
  • router: fix URL serialization so special characters are only encoded where needed (#22337) (094666d), closes #10280
  • router: don't use ParamsInheritanceStrategy in declarations (#21574) (925e654), closes #21456
  • service-worker: add badge to NOTIFICATION_OPTION_NAMES (#23241) (fb59b2d), closes #23196
  • service-worker: let * match 0 characters in globs (#23339) (6c2c958)
  • service-worker: do not enter degraded mode when offline (#22883) (9e9b8dd), closes #21636
  • service-worker: fix LruList bugs (#22769) (8c2a578), closes #22218 #22768
  • service-worker: ignore invalid only-if-cached requests (#22883) (d9dc46e), closes #22362
  • service-worker: properly handle invalid hashes in all scenarios (#21288) (3951098)
  • upgrade: correctly handle downgraded OnPush components (#22209) (ad9ce5c), closes #14286
  • upgrade: propagate return value of resumeBootstrap (#22754) (a2330ff), closes #22723
  • upgrade: two-way binding and listening for event (#22772) (2b3de63), closes #22734
  • upgrade: correctly destroy nested downgraded component (#22400) (8a85888), closes #22392
  • upgrade: correctly handle = bindings in [@angular](https://github.com/angular)/upgrade (#22167) (f089bf5)
  • upgrade: fix empty transclusion content with AngularJS@>=1.5.8 (#22167) (13ab91e), closes #22175

Possible Breaking Changes

 

 

  • animations: When animation is triggered within a disabled zone, the associated event (which an instance of AnimationEvent) will no longer report the totalTime as 0 (it will emit the actual time of the animation).

    To detect if an animation event is reporting a disabled animation then the event.disabled property can be used instead.

  • compiler: The tag was deprecated in Angular v4 to avoid collisions (i.e. when using Web Components).

    This change removes support for . should be used instead.

     

    BEFORE:

    
    some template content
    
    # tsconfig.json
    {
      # ...
      "angularCompilerOptions": {
        # ...
        # This option is no more supported and will have no effect
        "enableLegacyTemplate": [true|false]
      }
    }
    

    AFTER:

    
    some template content
    
  • core: it is no longer possible to import animation-related functions from @angular/core. All animation symbols must now be imported from @angular/animations.

  • forms: - AbstractControl#statusChanges now emits an event of 'PENDING' when you call AbstractControl#markAsPending

    • Previously it did not emit an event when you called markAsPending
    • To migrate you would need to ensure that if you are filtering or checking events from statusChanges that you account for the new event when calling markAsPending
  • forms: ngModelChange is now emitted after the value/validity is updated on its control.

    Previously, ngModelChange was emitted before its underlying control was updated. This was fine if you passed through the value directly through the $event keyword, e.g.

    
    
    onChange(value) {
       console.log(value);               // would log updated value
    }
    

    However, if you had a handler for the ngModelChange event that checked the value through the control, you would get the old value rather than the updated value. e.g:

    
    
    onChange(ngModel: NgModel) {
      console.log(ngModel.value);        // would log old value, not updated value
    }
    

    Now the value and validity will be updated before the ngModelChange event is emitted, so the same setup will log the updated value.

    onChange(ngModel: NgModel) {
       console.log(ngModel.value);       // will log updated value
    }
    

    We think this order will be less confusing when the control is checked directly. You will only need to update your app if it has relied on this bug to keep track of the old control value. If that is the case, you should be able to track the old value directly by saving it on your component.

Posted On 12th May 2018