Getting error while importing Platform, MenuController, AlertController, Nav, Tab, ToastController from ionic-angular


#1

Hello All,
I am new to ionic framework. I am trying to import Platform, MenuController, AlertController, Nav, Tab, ToastController from ionic-angular module. I am getting the error like "cannot fine module - ionic-angular.

Please let me know how can I resolve this?


#2

if you are using ionic 4.+, the import has changed from
from 'ionic-angular'

to

from'@ionic/angular'


#3

Hi jjdev,

Thanks for the reply :slight_smile:
I have changed to ‘@ionic/angular’
Now I am trying to do below
this.platform.registerBackButtonAction()

it is saying [ts] Property ‘registerBackButtonAction’ does not exist on type ‘Platform’.
Basically I want to inherit the behavior of backbutton so that user can go to the previous page while he clicks on back button.
is there any other way to do the same?


#4

it looks as though the registerBackButtonAction() method is deprecated

the new method is appears to use an observable now:
this.platform.backButton.subscribe(() => { ... })