﻿{"id":359,"date":"2022-03-04T16:42:24","date_gmt":"2022-03-04T11:12:24","guid":{"rendered":"https:\/\/blogs.infosys.com\/digital-experience\/?p=359"},"modified":"2022-03-04T16:42:24","modified_gmt":"2022-03-04T11:12:24","slug":"angular-13-new-features","status":"publish","type":"post","link":"https:\/\/blogs.infosys.com\/digital-experience\/web-ui-ux\/angular-13-new-features.html","title":{"rendered":"Angular 13 New Features"},"content":{"rendered":"<p>This blog discusses the Angular framework feature changes release as part of Angular Version 13.<\/p>\n<p><strong>Snippet from GitHub<\/strong><\/p>\n<p>The section mentions the key metrics (as of the date of writing this document) from GitHub. A probable indicator of platform adoption and stability.<\/p>\n<p><strong>Star<\/strong>\u00a0 \u00a0&#8211; 79.4k\u00a0 \u00a0<strong>Fork<\/strong> &#8211; 20.9k\u00a0 \u00a0 \u00a0 <strong>Open Issues<\/strong> &#8211; 1.6k\u00a0 \u00a0<strong>Closed Issues<\/strong> &#8211; 21k<\/p>\n<h6><strong>Source URL<\/strong>&#8211;\u00a0 https:\/\/github.com\/angular\/angular<\/h6>\n<h3><em><strong>New Features<\/strong><\/em><\/h3>\n<h4><span style=\"color: #000080\">IE 11 Support removal<\/span><\/h4>\n<p>Removal of IE 11 support enables angular to leverage modern browser features (for example \u2013 CSS variable, usage of modern browser API, etc.). Removal of IE 11 supports also resulted in the removal of IE 11 specific code from framework and polyfills, resulting in the smaller bundle and improved application performance.<\/p>\n<p><strong>Note for Developers<\/strong> &#8211; This change is a breaking change for organizations supporting IE 11 browser.<\/p>\n<p><strong>Reference URL<\/strong> &#8211;\u00a0<a href=\"https:\/\/github.com\/angular\/angular\/issues\/41840\">https:\/\/github.com\/angular\/angular\/issues\/41840<\/a><\/p>\n<h4><span style=\"color: #000080\">Component API update<\/span><\/h4>\n<p>One of the major changes in Angular 13 is the way the component is loaded dynamically. New component API has reduced a lot of boiler plate code. The new API uses ViewContainerRef.createComponent to dynamically load a component (without requiring an associated factory)<\/p>\n<p>Example<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-389\" src=\"https:\/\/blogs.infosys.com\/digital-experience\/wp-content\/themes\/infosys-blog\/images\/Sample-Image.jpg\" alt=\"\" width=\"300\" height=\"224\" \/><\/p>\n<h4><span style=\"color: #000080\">View Engine Removal<\/span><\/h4>\n<p>Angular 13 mandates it to build application\/library using IVY engine i.e. no more you can use view engine as rendering engine it has to be IVY or partial-ivy for libraries.<\/p>\n<p>How does it impact?<\/p>\n<p>Angular 13 still supports libraries published with a view engine. For view engine libraries NGCC still exists. Change is seamless for the application developer. For example, while migrating from Angular 12 to 13 applications should still be able to consume libraries developed using the view engine.<\/p>\n<p>The change impacts the library developers. The libraries developed being Angular 13 and to be published to NPM needs to be published with Partial Ivy (recommended) or Fully Ivy option.<\/p>\n<h4><span style=\"color: #000080\">Dependency Update<\/span><\/h4>\n<p>Angular 13 has a dependency on the upgraded version of RxJS, TypeScript &amp; NodeJS.<\/p>\n<ul>\n<li>RxJS RxJS 7.4 is the default for Angular 13 i.e. when new projects are created, they are created using RxJS 7.4. While migrating existing projects they remain on RxJS 6.x version, which needs to be manually upgraded to Version 7.4<\/li>\n<li>TypeScript Versions older than 4.4.2 are no longer supported<\/li>\n<li>NodeJS Versions older than v12.20.0 are no longer supported. The Angular packages now use the NodeJS package exports feature (Angular package format change). It requires NodeJS version above 14.15.0 or 16.10.0.<\/li>\n<\/ul>\n<p><strong>Note for developers<\/strong> &#8211; This could be a breaking change in the existing application being migrated from the lower version of angular to Angular 13. Refer to the RxJS and TypeScript documentation for any breaking changes.<\/p>\n<p><strong>Reference URLs<\/strong> \u2013<br \/>\nhttps:\/\/github.com\/angular\/angular\/pull\/43642<br \/>\nhttps:\/\/github.com\/angular\/angular\/pull\/43740<\/p>\n<h4><span style=\"color: #000080\">Angular Package Format (APF) Change<\/span><\/h4>\n<p>The angular package format is an angular-specific structure and format for NPM packages. Angular package format not only ensures packages work under the common scenario, but it is also compatible with toolchains available in a wider JavaScript ecosystem.<\/p>\n<p>APF changes are at the framework level and are seamless for the developer. The change results in leaner output and faster execution, optimizing overall application performance.<\/p>\n<p>To highlight a few of the changes \u2013<br \/>\n&#8211; APF has removed older output format &amp; view engine specific metadata<br \/>\n&#8211; Libraries built with the latest version of APF do not need NGCC (resulting in optimum output)<br \/>\n&#8211; Latest APF supports Node Package exports, prevents accidental dependency on internal APIs. Internal APIs might change at any time<\/p>\n<h4><span style=\"color: #000080\"><strong>Testing module teardown is default now<\/strong><\/span><\/h4>\n<p>Angular 12.1 added ModuleTeardownOptions (https:\/\/angular.io\/api\/core\/testing\/ModuleTeardownOptions) options object.<\/p>\n<p>interface ModuleTeardownOptions {<br \/>\ndestroyAfterEach: Boolean \/\/Default value to false prior to Angular 13<br \/>\nrethrowErrors?: boolean<br \/>\n}<\/p>\n<p>Setting the property \u201cDestroyAfterEach\u201d to true makes sure DOM is cleaned after every test. Resulting in faster, memory-optimized, optimized tests. The above configuration could be set for, the entire testbed via TestBed.initTestEnvironment method or for induvial module via TestBed.configureTestingModule Method.<br \/>\nBefore Angular 13 it was an opt-in option, with Angular 13 it\u2019s made default option. It can be customized per application need.<\/p>\n<p><strong>Note for Developers<\/strong> \u2013 Angular migration until carrying forwards the previous configuration i.e. if DestroyAfterEach has opted out-migration would not change the configuration it needs to be opted in manually.<\/p>\n<h4><span style=\"color: #000080\">Support to Inline Adobe fonts<\/span><\/h4>\n<p>Post Angular 11, framework supported in-lining google font. Angular 13 now supports inline Adobe fonts into index.html.<br \/>\nIn-lining font helps to improve page performance by speeding up the First contentful paint.<br \/>\nReference URL &#8211; https:\/\/github.com\/angular\/angular-cli\/issues\/21186<\/p>\n<ul>\n<li>Router Improvements<br \/>\nRouterLink directive with value as \u201cnull\u201d or \u201cundefined\u201d disables the navigation.<br \/>\nReference URL &#8211; https:\/\/github.com\/angular\/angular\/pull\/43087<\/li>\n<li>RouterLink allows question mark in query parameter value.<br \/>\nExample \u2013 \/path?param1=value1?&amp;param2=value2 will be parsed as {param1: \u201cvalue1?\u201d, param2: \u201cvalue2\u201d}<br \/>\nReference URL &#8211; https:\/\/github.com\/angular\/angular\/pull\/31187<\/li>\n<\/ul>\n<h3>This section describes few of the component libraries and its compatibility with Angular 13<\/h3>\n<p><strong>Library Name<\/strong> &#8211; Ng-bootstrap\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<strong>Supports\u00a0Angular 13<\/strong> &#8211; Y\u00a0 \u00a0 \u00a0 \u00a0 \u00a0\u00a0<strong>Reference URL<\/strong> &#8211; https:\/\/ng-bootstrap.github.io\/#\/getting-started<\/p>\n<p><strong>Library Name<\/strong> &#8211; Ngx-bootstrap \u00a0 \u00a0 \u00a0 \u00a0 \u00a0<strong>Supports Angular 13<\/strong> &#8211; Y \u00a0 \u00a0 \u00a0 \u00a0<strong>Reference URL<\/strong> &#8211; https:\/\/ng-bootstrap.github.io\/#\/getting-started<\/p>\n<p><strong>Library Name<\/strong> &#8211; Angular Material\u00a0 \u00a0 \u00a0<strong>Supports Angular 13<\/strong> &#8211; Y<\/p>\n<p><strong>Library Name<\/strong> &#8211; Prime NG\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <strong>Supports Angular 13<\/strong> &#8211; Y \u00a0 \u00a0 \u00a0 \u00a0<strong>Reference URL<\/strong> &#8211; https:\/\/ng-bootstrap.github.io\/#\/getting-started<\/p>\n<h3>Upgrade to Angular 13<\/h3>\n<p>Refer to the Angular upgrade guide URL &#8211; <a href=\"https:\/\/update.angular.io\/\">https:\/\/update.angular.io\/<\/a>. It provides a step-by-step guide to migrate the existing angular applications from lower version to a later version<\/p>\n<p><strong>Reference URLs<\/strong> \u2013<\/p>\n<p>https:\/\/angular.io\/guide\/update-to-latest-version<\/p>\n<p>https:\/\/blog.angular.io\/angular-v13-is-now-available-cce66f7bc296<\/p>\n<p>https:\/\/chriskohler.dev\/angular-view-engine-was-removed-what-you-need-to-know<\/p>\n<p>https:\/\/dev.to\/this-is-angular\/improving-angular-tests-by-enabling-angular-testing-module-teardown-38kh<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog discusses the Angular framework feature changes release as part of Angular Version [&hellip;]<\/p>\n","protected":false},"author":210,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2],"tags":[],"coauthors":[66],"class_list":["post-359","post","type-post","status-publish","format-standard","hentry","category-web-ui-ux"],"acf":[],"_links":{"self":[{"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/posts\/359","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/users\/210"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/comments?post=359"}],"version-history":[{"count":21,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/posts\/359\/revisions"}],"predecessor-version":[{"id":490,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/posts\/359\/revisions\/490"}],"wp:attachment":[{"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/media?parent=359"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/categories?post=359"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/tags?post=359"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/blogs.infosys.com\/digital-experience\/wp-json\/wp\/v2\/coauthors?post=359"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}