Vyacheslav Koldovskyy SoftServe ITA Competence Manager, t.me/programmingmentor
Angular 8 apps will now be more performant, thanks to Differential Loading of Modern JavaScript. With differential loading, new apps generated by Angular CLI will now contain separate bundles for legacy JavaScript (ES5) and modern JavaScript (ES2015+).
Angular 8 feature added backward compatibility mode to Angular router that helps to upgrade the path for large projects and will make it easier to move to Angular by allowing lazy loading parts of Angular v1.x apps using $route APIs.
In simple word, we will be able to upgrade our Angular 1.x apps to Angular 2+ right away.
The Angular Team wants to provide support for all developers using AngularJS to upgrade them with the latest Angular so some enhancements have been made to provide better integration with the AngularJS $location service in hybrid (AngularJS <=> Angular) apps. A new package angular/common/upgrade is added and help you
Thanks to Angular CLI 8, web workers are included while building the production bundles which are essential for improving the parallelizability and helps increase the performance.
Angular 8.0 is thus adding building support to CLI which provides one bundle for every web worker.
$ npm run ng g webWorker worker
In previous angular versions, the route configuration uses the property @loadChildren which accepts a string and if there was a wrong module name or any typo while writing the code, Angular would not consider it wrong and accept whatever value was there as a string until we try building it.
So to overcome that they have added support for dynamic imports in router configuration in latest Angular 8 which enable the use of import statement for lazy loading the module and this will be understood by the IDEs, webpack etc.
Now Editor will understand what's this syntax and will recognize if there is some mistake and we won't have to wait till build time to realize about an error.
View Engine (4.0) has some limitations:
Angular Ivy (8-9) new compiler and runtime:
React was the first mainstream framework to use virtual DOM, which is defined by this key idea:
Every component creates a new virtual DOM tree every time it gets rerendered. React compares the new virtual DOM tree with the old one and then applies a series of transformations to the browser DOM to match the new virtual DOM tree.
Incremental DOM is used internally at Google, and it is defined by this key idea:
Every component gets compiled into a series of instructions. These instructions create DOM trees and update them in-place when the data changes.
component source
Why did the Google team go with incremental DOM instead of virtual DOM?
They have one goal in mind: applications have to perform well on mobile devices. This mainly meant optimizing two things: the bundle size and the memory footprint.
To achieve the two goals:
When using incremental DOM, the framework does not interpret the component. Instead, the component references instructions. If it doesn’t reference a particular instruction, it will never be used. And since we know this at compile time, we can omit the unused instruction from the bundle.
Virtual DOM requires an interpreter. What part of that interpreter is needed and what part is not isn’t known at compile time, so we have to ship the whole thing to the browser.
Virtual DOM creates a whole tree from scratch every time you rerender.
Incremental DOM doesn’t need any memory to rerender the view if it doesn’t change the DOM so it allocates the memory when the DOM nodes are added or removed. since most of render/template calls don’t change anything result in huge memory savings.
The build time is proportional to the numbers of files
The build time should be dependent to the number of changes
Bazel workspace Is a folder containing the source files of your project and has a file named "workspace"
npx @angular/cli@next new ng9
Not released yet
Release Candidate Available
Can be used without install:
Angular 8.2.7
Angular 9.0.0-next5
Angular 8 Ivy preview doesn't support selector-less directives as base classes (supported by ViewEngine)
With Angular 9, this feature has been added to Ivy so that developers get the advantages of Ivy compilation, but don’t miss previous functionality.
In Angular 9, the i18n code has been refactored to provide a better platform for adding compile-time inlining.
<h1 i18n>Hello world!</h1>
<trans-unit id="a05c3a315a6ee3e6ad4733a1f72e8d16775810ca" datatype="html">
<source>Hello World!</source>
<target/>
</trans-unit>
https://youtu.be/5wmWtgr7LQ0