[Angular] New in V6.1

Router Scroll Position Restoration:

remember and restore scroll position as the user navigates around an application.

RouterModule.forRoot(routes, {scrollPositionRestoration: 'enabled'})

ShadowDOM v1 View Encapsulation:

ViewEncapsulation.Native is now deprecated. 

ShadowDOM v1 has better cross-browser support than the previous version, and is being built as a shared standard across browsers.

@Component({
  templateUrl: './my-component.html',
  encapsulation: ViewEncapsulation.ShadowDom
})
export class MyComponent { }

keyvalue Pipe:

@Component({
  template: `<div *ngFor="let item of data | keyvalue">
      {{item.key}} - {{item.value}}
    </div>`
})
export class MyComponent {
  data = { "key": "value", "key2": "value2" };
}
原文地址:https://www.cnblogs.com/Answer1215/p/9398671.html