全部課程
發(fā)布時(shí)間: 2021-11-09 16:35:38
Angular 仍然是一個(gè)非常受歡迎的框架。
將 Angular 渲染推向未來
棄用 View Engine,全面啟用 Ivy,Ivy 是 Angular 下一代編譯和渲染引擎。
對(duì) Angular Package Format (APF) 的更改
簡(jiǎn)化 APF,刪除舊的輸出格式,包括 View Engine 的特定元數(shù)據(jù)
使用最新版本的 APF 構(gòu)建的庫(kù)將不再需要使用 ngcc,因此,庫(kù)開發(fā)人員可以期待更精簡(jiǎn)的包輸出和更快的執(zhí)行
更新 APF 以支持 Node Package Exports
Component API 更新
新 API 無需 ComponentFactoryResolver 注入構(gòu)造函數(shù),示例如下:
以下是使用先前版本的 Angular 創(chuàng)建組件的示例:
@Directive({ … })
export class MyDirective {
constructor(private viewContainerRef: ViewContainerRef,
private componentFactoryResolver:
ComponentFactoryResolver) {}
createMyComponent() {
const componentFactory = this.componentFactoryResolver.
resolveComponentFactory(MyComponent);
this.viewContainerRef.createComponent(componentFactory);
}
}
使用新的 API,這段代碼可以變成:
@Directive({ … })
export class MyDirective {
constructor(private viewContainerRef: ViewContainerRef) {}
createMyComponent() {
this.viewContainerRef.createComponent(MyComponent);
}
}
不再支持 IE11
是的。移除 IE11 支持意味著 Angular 可以通過原生 Web API 利用現(xiàn)代瀏覽器功能,例如 CSS 變量和 Web 動(dòng)畫。同時(shí)可以從代碼中移除針對(duì) IE 特定的 polyfills 和代碼路徑,從而使應(yīng)用程序更小,加載速度更快,用戶也將受益于更快的加載而擁有更好的體驗(yàn)。
其他
改進(jìn) Angular CLI
更改框架和依賴項(xiàng)更新
改進(jìn) Angular 測(cè)試
?