zl程序教程

您现在的位置是:首页 >  前端

当前栏目

[Angular] New in V6.1

Angular in New
2023-09-14 08:59:17 时间

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" };
}