Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cannot find module 'ionic-angular'.ts when version upgraded to Ionic 4

I have this code in Ionic 3. In Ionic 4,

Cannot find module 'ionic-angular'.ts(2307)

How can I make it work in ionic 4? can find any solutions...

  import { Events, Content } from 'ionic-angular';

  @ViewChild(Content) content: Content;
  this.content.resize();
  this.content.scrollToBottom()
like image 602
GO VEGAN Avatar asked Oct 19 '25 05:10

GO VEGAN


2 Answers

Follow these detailed migration steps in order to upgrade from Ionic 3 to 4: https://ionicframework.com/docs/building/migration

For this specific error the answer is:

import { Events, IonContent } from '@ionic/angular';

@ViewChild(IonContent) content: IonContent;
// resize() is removed in Ionic 4 (not needed)
this.content.scrollToBottom();
like image 136
Remi Sture Avatar answered Oct 20 '25 18:10

Remi Sture


From ionic 4 you import statement of ionic-angular slightly changed. please import like below.

import { Events, Content } from '@ionic/angular';

Here is a Demo on stackblitz

Hope this will help!

like image 42
TheParam Avatar answered Oct 20 '25 19:10

TheParam