<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Th3CracKed</title>
    <description>The latest articles on DEV Community by Th3CracKed (@th3cracked).</description>
    <link>https://dev.to/th3cracked</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F357095%2F5ed7f6e2-abba-4a32-8121-734cf8044f8d.png</url>
      <title>DEV Community: Th3CracKed</title>
      <link>https://dev.to/th3cracked</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/th3cracked"/>
    <language>en</language>
    <item>
      <title>Update to Angular 9 With Envy Compiler</title>
      <dc:creator>Th3CracKed</dc:creator>
      <pubDate>Sun, 29 Mar 2020 10:07:20 +0000</pubDate>
      <link>https://dev.to/th3cracked/update-to-angular-9-with-envy-compiler-5can</link>
      <guid>https://dev.to/th3cracked/update-to-angular-9-with-envy-compiler-5can</guid>
      <description>&lt;p&gt;In this article I don't want to focus on the new features of angular 9 and the new compiler, but instead give a quick guide of how to update from Angular 8 to Angular 9.&lt;/p&gt;

&lt;h1&gt;
  
  
  Before updating :
&lt;/h1&gt;

&lt;p&gt;Make sure you have tslib installed:  npm install tslib --save&lt;/p&gt;

&lt;h1&gt;
  
  
  During Update :
&lt;/h1&gt;

&lt;p&gt;'ng update' and follow the instructions.&lt;br&gt;
Angular will automatically change :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The @angular/material imports, to import deeply from the specific component.&lt;/li&gt;
&lt;li&gt;String imports to the new import(), for lazy loaded modules via the router.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Examples :&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is no longer working : &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {MatTableModule} from '@angular/material'; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Instead :&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {MatTableModule} from '@angular/material/table'; 
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is no longer working : &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const routes: Routes = [{
  path: 'lazy',
  // The following string syntax for loadChildren is deprecated
  loadChildren: './lazy/lazy.module#LazyModule'
}];
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Instead :&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const routes: Routes = [{
  path: 'lazy',
  // The new import() syntax
  loadChildren: () =&amp;gt; import('./lazy/lazy.module').then(m =&amp;gt; m.LazyModule)
}];
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;h1&gt;
  
  
  After the update :
&lt;/h1&gt;

&lt;p&gt;You can use the search feature of your code Editor to search for 'entryComponents' and remove all results.&lt;br&gt;
'ANALYZE_FOR_ENTRY_COMPONENTS' and remove all results&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;RXJS :&lt;/strong&gt;&lt;br&gt;
You should not use internal operators in the new version of Rxjs.&lt;br&gt;
This is no longer working : &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Subscription } from 'rxjs/internal/Subscription';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;Instead :&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { Subscription } from 'rxjs';
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;you can avoid imports changes by doing npm install --save rxjs-compat which is not recommended since Rxjs made the changes to reduce the bundle size of applcations.&lt;/p&gt;

&lt;p&gt;If you use ngForm element selector to create Angular Forms, you should instead use ng-form.&lt;/p&gt;

&lt;p&gt;Search for 'TestBed.get' replace it with 'TestBed.inject'  , TestBed.inject is the new method for testing that add type safety.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Third-party dependencies :&lt;/strong&gt; &lt;br&gt;
You should check the changelogs of every dependency to know if it's compatible with angular 9 and do the update with ng update dependencyName.&lt;br&gt;
Check github issues, sometimes usefull informations are found there, or open a new issue&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;TypeScript :&lt;/strong&gt;&lt;br&gt;
Angular 9 is using typescript 3.7 which has a more robust type checking system, you may encounter some errors due to that, try to fix them or  opt out by adding the &lt;strong&gt;&lt;em&gt;'any'&lt;/em&gt;&lt;/strong&gt; keyword&lt;/p&gt;

&lt;p&gt;For Dynamic query flags in @ViewChild() and @ContentChild(), Angular 9 consider the default value to be false, you can search ', {static: false}' and remove it&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Replace &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@ViewChild('foo', {static: false}) foo: ElementRef;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;With&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@ViewChild('foo') foo: ElementRef;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;If you didn't &lt;a href="https://angular.io/guide/static-query-migration"&gt;migrate static query&lt;/a&gt; for angular 9 you may want to check how to do it.&lt;/p&gt;

&lt;p&gt;If you have any error put it in the comment, I may be able to help.&lt;br&gt;
Also If you encountered an error, and you found a solution for it please share in the comment so I can give a more detailed guide&lt;/p&gt;

&lt;p&gt;Ressources: &lt;br&gt;
&lt;a href="https://update.angular.io/#8.0:9.0l3"&gt;https://update.angular.io/#8.0:9.0l3&lt;/a&gt;&lt;br&gt;
&lt;a href="https://angular.io/guide/updating-to-version-9#new-breaking-changes"&gt;https://angular.io/guide/updating-to-version-9#new-breaking-changes&lt;/a&gt;&lt;br&gt;
&lt;a href="https://academind.com/learn/javascript/rxjs-6-what-changed/"&gt;https://academind.com/learn/javascript/rxjs-6-what-changed/&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html"&gt;https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-6.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html"&gt;https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html&lt;/a&gt;&lt;br&gt;
&lt;a href="https://angular.io/guide/updating-to-version-9#automated-migrations-for-version-9"&gt;https://angular.io/guide/updating-to-version-9#automated-migrations-for-version-9&lt;/a&gt;&lt;/p&gt;

</description>
      <category>angular</category>
    </item>
  </channel>
</rss>
