Angular v13正式发布,全面弃用 View Engine

目录
文章目录隐藏
  1. 将 Angular 渲染推向未来
  2. 对 Angular Package Format (APF) 的更改
  3. Component API 更新
  4. 不再支持 IE11
  5. 其他

Angular 仍然是一个非常受欢迎的框架。

将 Angular 渲染推向未来

弃用 View Engine,全面启用 IvyIvy 是 Angular 下一代编译和渲染引擎。

对 Angular Package Format (APF) 的更改

  • 简化 APF,删除旧的输出格式,包括 View Engine 的特定元数据
  • 使用最新版本的 APF 构建的库将不再需要使用 ngcc,因此,库开发人员可以期待更精简的包输出和更快的执
  • 更新 APF 以支持 Node Package Exports

Component API 更新

新 API 无需 ComponentFactoryResolver 注入构造函数,示例如下:

以下是使用先前版本的 Angular 创建组件的示例:

@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 利用现代浏览器功能,例如 CSS 变量和 Web 动画。同时可以从代码中移除针对 IE 特定的 polyfills 和代码路径,从而使应用程序更小,加载速度更快,用户也将受益于更快的加载而拥有更好的体验。

其他

  • 改进 Angular CLI
  • 更改框架和依赖项更新
  • 改进 Angular 测试

「点点赞赏,手留余香」

1

给作者打赏,鼓励TA抓紧创作!

微信微信 支付宝支付宝

还没有人赞赏,快来当第一个赞赏的人吧!

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。
码云笔记 » Angular v13正式发布,全面弃用 View Engine

发表回复