Apk creation success , but after loading show a white page. Why?


#1

Friends,
I cleanup my working code with apk in ionic 3. But now I can create apk but after loading show a white page. On seeing in console i got error as

Uncaught Error: Unexpected value 'undefined' imported by the module 'AppModule'
    at syntaxError (vendor.js:101286)
    at vendor.js:114984
    at Array.forEach (<anonymous>)
    at CompileMetadataResolver.getNgModuleMetadata (vendor.js:114961)
    at JitCompiler._loadModules (vendor.js:126391)
    at JitCompiler._compileModuleAndComponents (vendor.js:126364)
    at JitCompiler.compileModuleAsync (vendor.js:126293)
    at PlatformRef_._bootstrapModuleWithZone (vendor.js:4893)
    at PlatformRef_.bootstrapModule (vendor.js:4879)
    at Object.451 (main.js:4721)

my app.module.ts is

import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { IonicApp, IonicErrorHandler, IonicModule } from 'ionic-angular';
import { HttpModule } from '@angular/http';
import { SplashScreen } from '@ionic-native/splash-screen';
import { StatusBar } from '@ionic-native/status-bar';
import { AboutPageModule } from '../pages/about/about.module';
import { ContactPageModule } from '../pages/contact/contact.module';
import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { TabsPageModule } from '../pages/tabs/tabs.module';
import { WelcomePageModule} from '../pages/welcome/welcome.module';
//import {BrokerListPageModule} from '../pages/broker-list/broker-list.module';


import {LocalbodyListPageModule} from '../pages/localbody-list/localbody-list.module';

//import {BrokerDetailPageModule} from '../pages/broker-detail/broker-detail.module';


import { Toast } from '@ionic-native/toast';
import { SettingsPageModule } from '../pages/settings/settings.module';

import { GovtorderPageModule } from '../pages/govtorder/govtorder.module';
import { SearchPageModule } from '../pages/search/search.module';

import { SearchbarPageModule } from '../pages/searchbar/searchbar.module';
//import { DetailPageModule } from '../pages/detail/detail.module';
import { GosearchPageModule } from '../pages/gosearch/gosearch.module';
import { InfoPageModule } from '../pages/info/info.module';
import { VerificationResultPageModule } from "../pages/verification-result/verification-result.module";
import { VerificationPageModule } from "../pages/verification/verification.module";
import { DownloadPageModule } from '../pages/download/download.module';
import { OfflinePageModule } from '../pages/offline/offline.module';
//import { CloudSettings, CloudModule } from '@ionic/cloud-angular';
import { LoginPageModule } from '../pages/login/login.module';
import { GlobalProvider } from '../providers/global/global';
import { GoserviceProvider } from '../providers/goservice/goservice';


//import { ElectionServiceProvider } from '../providers/election-service/election-service';
//import { AppPreferences } from '@ionic-native/app-preferences';
import { Sim } from '@ionic-native/sim';
import { BrowserTab } from '@ionic-native/browser-tab';
import { Network } from '@ionic-native/network';
import { NativePageTransitions } from '@ionic-native/native-page-transitions';
import {AboutModalComponent} from '../components/about/about-modal.component';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import { SharePageModule } from '../pages/share/share.module';
import { SocialSharing } from '@ionic-native/social-sharing';
import { MenuProvider } from '../providers/menu/menu';
import { DatabaseProvider } from '../providers/database/database';



import { LbsettingsPageModule } from '../pages/lbsettings/lbsettings.module';
import { CrsearchPageModule } from '../pages/crsearch/crsearch.module';
import { CrsearchviewPageModule } from '../pages/crsearchview/crsearchview.module';
import { OnlineservicePageModule } from '../pages/onlineservice/onlineservice.module';
import { DNS } from '@ionic-native/dns';
import {ProgressBarModule} from "angular-progress-bar"

//Property Tax 
import {PayPage} from '../pages/pay/pay';

import { PropertyProvider } from '../providers/property/property';
import { PropertyTaxSettingsPageModule } from "../pages/PropertyTaxsettings/PropertyTaxSettings.module";


import { PropertyTaxPage } from '../pages/property-tax/property-tax';
import { PaymentReceiptPage } from '../pages/payment-receipt/payment-receipt';
//import { HttpClientModule, HTTP_INTERCEPTORS } from '@angular/common/http';
import { HttpClientModule } from '@angular/common/http';
import{ Device } from '@ionic-native/device';
import { File } from '@ionic-native/file';
import{ FileOpener } from '@ionic-native/file-opener';

//Cr Certificate
 
import { CrDataProvider } from '../providers/cr-data/cr-data';
import { CrSelectRegTypePage } from '../pages/crSelectRegType/crSelectRegType';
import { CrSearchFormPage } from '../pages/crSearchForm/crSearchForm';

//Ends

import { OwnershipCertificatePage } from '../pages/ownership-certificate/ownership-certificate';
import {OwnershipCertificateProcessingPage} from '../pages/ownership-certificate-processing/ownership-certificate-processing';

import { IonicStorageModule } from '@ionic/storage';
import { CertificateProvider } from '../providers/certificate/certificate';
import { StatusProvider } from '../providers/status/status';
// Add interceptor
//import { RequestInterceptor } from '../common/interceptor/request.interceptor';
import { BuildingPermitstatusPage } from '../pages/building-permitstatus/building-permitstatus';
import {NoticePage } from '../pages/notice/notice';
import { DatePipe } from '@angular/common';
import { GramasabhaPage } from '../pages/gramasabha/gramasabha';
@NgModule({
  declarations: [
    MyApp,
    HomePage,
  //property tax
     PropertyTaxPage,     
     PayPage,
     PaymentReceiptPage,     
   //ends
   AboutModalComponent,
   //CR
   CrSelectRegTypePage,
   CrSearchFormPage,
   OwnershipCertificatePage,
   OwnershipCertificateProcessingPage,
   BuildingPermitstatusPage,
   NoticePage,
   GramasabhaPage
  ],
  imports: [
        BrowserModule,HttpModule,AboutPageModule,ContactPageModule,TabsPageModule,ProgressBarModule,
        WelcomePageModule,LocalbodyListPageModule,
        DownloadPageModule,OfflinePageModule,SettingsPageModule,
        InfoPageModule,VerificationPageModule,VerificationResultPageModule,
        GovtorderPageModule,SearchPageModule,SearchbarPageModule,
        GosearchPageModule,LoginPageModule,SharePageModule,
        ,LbsettingsPageModule,CrsearchPageModule,CrsearchviewPageModule,OnlineservicePageModule,
		
    //Property tax    
         HttpClientModule, 
		 PropertyTaxSettingsPageModule,
    //Ends
       
    
   IonicModule.forRoot(MyApp, {
        backButtonText: '',
        iconMode: 'ios',
        modalEnter: 'modal-slide-in',
        modalLeave: 'modal-slide-out',
        tabsPlacement: 'bottom',
        pageTransition: 'ios',
    }),
    IonicStorageModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,AboutModalComponent,
  //Property Tax
    PropertyTaxPage,  
	  PayPage,
    PaymentReceiptPage,
  //Ends
  CrSelectRegTypePage ,
  CrSearchFormPage,
  OwnershipCertificatePage,
  OwnershipCertificateProcessingPage,
  BuildingPermitstatusPage,
  NoticePage,
  GramasabhaPage
  ],
  providers: [
    //AppPreferences,
    StatusBar,Sim,BrowserTab,Network,NativePageTransitions,InAppBrowser,
    SplashScreen,Toast,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
   // { provide: HTTP_INTERCEPTORS, useClass: RequestInterceptor, multi: true },
    GlobalProvider,GoserviceProvider,SocialSharing,
    MenuProvider,DatabaseProvider,DNS,
//property tax	 
    PropertyProvider, 
    Device,
    File,
    FileOpener,   
//Ends
//CR Data
    CrDataProvider,
    CertificateProvider,
    StatusProvider,
//Ends
DatePipe
  ]
})
export class AppModule {}

any body advise whats the problem is ?

Waiting fast reply

Thanks
Anes


#2

What IDE are you using? I’m using WebStorm and this kind of thing would be showing as an error with a red underline in the file, if I was trying to import something that was undefined.


#3

A little bit off-topic but I see that you import your “pageName”.module files in your app.module. I’m not sure but I don’t think that you should do it like that. Maybe someone with more info would correct me and/or help you out with that, what looks to me, bigger problem…


#4

I am using VS code … .According to you i downloading Web storm and will install soon

Thanks

Anes


#5

VSCode should be fine. Don’t worry about WebStorm. In your VSCode file, are you seeing any red squiggly lines under any file names or inside any files?


#6

If you’re only programming Ionic, I think VS Code makes more sense. If you’re programming in many different environments, WebStorm is probably a better tool.


#7

No bwhiting. may i need to add app.component.ts

please look it and advise

import { Component,ViewChild } from '@angular/core';
import { Platform,Nav,ToastController,ModalController,LoadingController} from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
//import { GoogleAnalytics } from '@ionic-native/google-analytics';
import { Device,GoogleAnalytics } from 'ionic-native';
import { Toast } from '@ionic-native/toast';
import { AboutPage } from '../pages/about/about';
import { HomePage } from '../pages/home/home';


import { LocalbodyListPage } from '../pages/localbody-list/localbody-list';
import { WelcomePage } from '../pages/welcome/welcome';
import { SearchPage } from '../pages/search/search';
import { SearchbarPage } from '../pages/searchbar/searchbar';
import { TabsPage } from '../pages/tabs/tabs';
import { SettingsPage } from '../pages/settings/settings';
import { GovtorderPage } from '../pages/govtorder/govtorder';
import { DatabaseProvider } from "../providers/database/database";
import { GlobalProvider } from "../providers/global/global";
import { Analytics_id } from '../providers/config/config';
import { SharePage } from '../pages/share/share';
import { InfoPage } from '../pages/info/info';
import { VerificationPage } from "../pages/verification/verification";
import { GosearchPage } from '../pages/gosearch/gosearch';
import { DownloadPage } from '../pages/download/download';
import { ContactPage } from '../pages/contact/contact';
import { OfflinePage } from '../pages/offline/offline';
import { LoginPage } from '../pages/login/login';

import {LbsettingsPage} from '../pages/lbsettings/lbsettings';

//property tax
import {PropertyTaxSettingsPage} from '../pages/PropertyTaxsettings/PropertyTaxSettings';
//
import { Sim } from '@ionic-native/sim';
import { Network } from '@ionic-native/network';
import { NativePageTransitions, NativeTransitionOptions } from '@ionic-native/native-page-transitions';
import {AboutModalComponent} from '../components/about/about-modal.component';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import {MenuProvider} from '../providers/menu/menu';


import { CrsearchPage } from '../pages/crsearch/crsearch';
import { CrsearchviewPage } from '../pages/crsearchview/crsearchview';
import {PropertyTaxPage} from '../pages/property-tax/property-tax';
//Property tax
import { HttpClientModule } from '@angular/common/http';
//Ends
//CR
import { CrSelectRegTypePage } from '../pages/crSelectRegType/crSelectRegType';
import { OwnershipCertificatePage } from '../pages/ownership-certificate/ownership-certificate';
import { BuildingPermitstatusPage } from '../pages/building-permitstatus/building-permitstatus';
//Ends
import { NoticePage } from '../pages/notice/notice';
import { GramasabhaPage } from '../pages/gramasabha/gramasabha';
import { IonicApp } from 'ionic-angular';
declare var window: any;
export interface MenuItem {
  title: string;
  titleM: string;
  component: any;
  icon: string;
}
var backbutton = 0;
@Component({
  templateUrl: 'app.html'
})
export class MyApp {
    @ViewChild(Nav) nav: Nav;
    rootPage:any = HomePage;
    loading: any = null;
    lbid:number;
    lbname:string;
    distid:number;
    lbtype:number;
    //rootPage: any = OwnershipCertificatePage;

      //rootPage:any = WelcomePage;
    private rootPageToExitOn: string = "HomePage";
    private OnlineService: string = "OnlineservicePage";
    public title: string = "mGov Services";
    public language: boolean = false;
    appMenuItems: Array<MenuItem>;
    helpMenuItems: Array<MenuItem>;
    OtherMenuItems: Array<MenuItem>;
    //Menu_Item: Array<MenuItem>;
  
  constructor(private toast: Toast, 
    private modalCtrl: ModalController,
    private nativePageTransitions: NativePageTransitions,
    private network: Network,private sim: Sim,
    public global1: GlobalProvider,
    public toastCtrl: ToastController,
    public menu: MenuProvider,
    public platform: Platform, 
    public statusBar: StatusBar, 
    public sqlite: DatabaseProvider,
    public splashScreen: SplashScreen,
    private loadingCtrl: LoadingController,
    private ionicApp:IonicApp
    ) {
    platform.ready().then(() => {
      // Okay, so the platform is ready and our plugins are available.
      // Here you can do any higher level native things you might need.
      statusBar.styleDefault();
      this.global1.navPage = "HomePage";
           // splashScreen.hide();
          if (splashScreen) {
            setTimeout(() => {
             splashScreen.hide();
             
         }, 100);
    }
    this.initializeApp();  
  });
 

let options: NativeTransitionOptions = {
    direction: 'up',
    duration: 500,
    slowdownfactor: 3,
    slidePixels: 20,
    iosdelay: 100,
    androiddelay: 150,
    fixedPixelsTop: 0,
    fixedPixelsBottom: 60
   };

    this.appMenuItems =
    [   {"title": "Home",  "titleM": "ഹോം", "component": HomePage,"icon": "home" },
        {"title": "Govt Orders","titleM": "സര്‍ക്കാര്‍ ഉത്തരവുകള്‍ ","component": GosearchPage, "icon": "search" },
        //{"title": "Govt Orders","titleM": "സര്‍ക്കാര്‍ ഉത്തരവുകള്‍ ","component": CrsearchviewPage, "icon": "search" },
        
        /*{"title": "CR Verification","titleM": "വേരിഫിക്കേഷന്‍", "component": VerificationPage,"icon": "share-alt"},*/
        {"title": "e Pay Building Tax ","titleM": "ഇ പേയ്മെന്റു കെട്ടിട നികുതി   ", "component": PropertyTaxSettingsPage,"icon": "card"},
        {"title": "Certificates (Birth/Death/Marriage) ","titleM": "സര്‍ട്ടിഫിക്കറ്റുകള്‍ (ജനന/മരണ,വിവാഹം)   ", "component": CrSelectRegTypePage,"icon": "md-download"},
        /*{"title": "CR View","titleM": "CR view", "component": CrsearchviewPage,"icon": "star"},*/
        {"title": "Building Status","titleM": "ബിൽഡിംഗ്  സ്റ്റാറ്റസ്", "component": BuildingPermitstatusPage,"icon": "search" },
     //   {"title": "Property Tax ","titleM": "Property Tax", "component": PropertyTaxPage,"icon": "star" },
     {"title": "Ownership Certificate ","titleM": "Ownership Certificate", "component": OwnershipCertificatePage,"icon": "star" },
     ];
      /*
    this.helpMenuItems = [
       { title: 'About',"titleM": "About", component: AboutPage, icon: 'star' },
       { title: 'Info', "titleM": "Info",component: InfoPage, icon: 'star' },
      
    ];
    */
    this.OtherMenuItems = [
     
      { title: 'Share this App', "titleM": "",component: SharePage, icon: 'md-share' },
      { title: 'Local Body Settings',"titleM": "", component: LbsettingsPage, icon: 'md-hammer' },
      
    ];
if (this.platform.is('cordova')) {
      
            this.sim.getSimInfo().then(
            (info) => console.log('Sim info: ', info),
            (err) => console.log('Unable to get sim info: ', err)
          );

          this.sim.hasReadPermission().then(
            (info) => console.log('Has permission: ', info)
          );

          this.sim.requestReadPermission().then(
            () => console.log('Permission granted'),
            () => console.log('Permission denied')
          );
   }else{
       //this.showToastExit("Cordova not avilable !");
   }


   
  }
      
       showToastNew(message, position) {
            this.toast.show(message, '3000', position).subscribe(
            toast => {console.log(toast); });
    }
      
    openSettingsPage() {
            if(this.global1.navPage!="SettingsPage")
            {
              this.nav.push(SettingsPage);
              this.global1.navPage="SettingsPage";   
            }
      
     }
    showToast(message1: string) {
          const toast = this.toastCtrl.create({
          message: message1,
          showCloseButton: false,
         closeButtonText: 'Ok', duration: 3000

         });
           toast.present();
        }
  
   openAboutModal() {
        const modal = this.modalCtrl.create(AboutModalComponent);
        modal.present()
  }

  showToastExit(message1: string) {
           const toast = this.toastCtrl.create({
           message: message1,
           showCloseButton: false,
            closeButtonText: 'Ok', duration: 2000,
            position: 'bottom'

        });
         setTimeout(() => {
        backbutton = 0;
        }, 2000);
       toast.present();
       }
         disconnectSubscription = this.network.onDisconnect().subscribe(() => {
          this.showToast("Offline!");
          //alert("dd: "+this.global1.navPage);
          this.global1.setnetwork(false);
          if(this.global1.navPage=="OnlineservicePage")
          {
            //this.nav.push(InfoPage);
            //this.global1.showNetworkAlert();
            if(this.network.type === 'none') {
              if(!this.loading) {
                this.loading = this.loadingCtrl.create(
                {
                  content: 'Network Disconnected'
                });
              this.loading.present();
              }
            }
            this.network.onDisconnect()
              .subscribe( () => {
                  if(!this.loading) {
                  this.loading = this.loadingCtrl.create(
                  {
                    content: 'Network Disconnected'
                  });
                this.loading.present();
                }
              });
            this.network.onConnect()
              .subscribe(() => { 
                setTimeout( () => {
                  if(this.network.type === 'wifi')
                  {
                    console.log('wifi connection got!');
                  } 
                },3000);
                if(this.loading) 
                {
                  this.loading.dismiss();
                  this.loading = null;
                }
              });
          }
            //this.global1.setnetwork(false);
            console.log('network was disconnected :-(');
          });
        connectSubscription = this.network.onConnect().subscribe(() => {
            console.log('network connected!');
            // this.showToast("Online!");
             this.global1.setnetwork(true);
     
      setTimeout(() => {
        if (this.network.type === 'wifi') {
          console.log('we got a wifi connection, woohoo!');
        }
      }, 3000);
    }); 
                  connectonchange=this.network.onchange().subscribe(() => {
                  switch (this.network.type) {
                  case '2g':
                    console.log('probably not very fast ...');
                    this.showToast("2G!");
                    break;
                  case 'wifi':
                    console.log('wohoo wifi ...');
                    this.showToast("WIFI");
                    break;
                    case 'none':
                    console.log('No network ...');
                    this.showToast("No Network");
                    //Experimental
                    //alert("ddTS: "+this.global1.navPage);
                    //this.synchronize();
                    break;
                    case '4g':
                    console.log('4G ...');
                    this.showToast("4G");
                    break; 
                    case '3g':
                    console.log('3G ...');
                    this.showToast("3G");
                    break;
                    case 'unknown':
                    console.log('unknown network ...');
                    this.showToast("unknown Network");
                    break;

                    //unknown, ethernet, wifi, 2g, 3g, 4g, cellular, none
                }
              });
 
       synchronize() {
              this.network.onDisconnect()
              .subscribe( () => {
                if(!this.loading) {
                  this.loading = this.loadingCtrl.create(
                  {
                    content: 'Network Disconnected'
                  });
                this.loading.present();
                }
              });
            this.network.onConnect()
              .subscribe(() => { 
                setTimeout( () => {
                  if(this.network.type === 'wifi')
                  {
                    console.log('wifi connection got!');
                  } 
                },3000);
                if(this.loading) 
                {
                  this.loading.dismiss();
                  this.loading = null;
                }
              });            
            } 
   initializeApp() 
  {
       
    this.platform.registerBackButtonAction(() => {
    if (backbutton == 0) { // handling clicking back button
          
      let activePortal = this.ionicApp._loadingPortal.getActive() 
                         || this.ionicApp._modalPortal.getActive() 
                         || this.ionicApp._toastPortal.getActive() 
                         || this.ionicApp._overlayPortal.getActive(); 
      if (activePortal) { activePortal.dismiss(); }
      if (this.global1.navPage == this.rootPageToExitOn) {
        backbutton++;
        this.showToastExit("Press BACK button to Exit !");

        // try dismiss
        this.loading.dismiss();
        this.loading = null;
        





      }
      else {
        //  this.title='mGov Services';
        if (this.global1.navPage == this.OnlineService) {
          if (this.global1.getnetwork()) {
            this.nav.pop();
            this.showToast("Online Network !");
            //alert("online network");
          }
          else {
            // this.nav.push(InfoPage);
            this.showToast("Offline !");
            this.nav.pop();
            //alert("online network not available");
          }
          // this.showToast("Online Service Page !");
        }
        else {
          this.nav.pop();
        }        
      }
    }
    else {
      navigator['app'].exitApp();
    }
  });
     
  //this.appPreferences.store('deviceguuid',Device.uuid);
  //Set Language initial from appPref
  //commented for app pref
  //this.Language();
  //this.appPreferences.store('mobileno',Device.);
  this.global1.uuid = Device.uuid;
  var googleuserid = this.global1.uuid;
  if (typeof GoogleAnalytics !== 'undefined') {
    GoogleAnalytics.debugMode()
    GoogleAnalytics.startTrackerWithId(Analytics_id);
    GoogleAnalytics.setUserId(googleuserid);
    GoogleAnalytics.enableUncaughtExceptionReporting(true)
    .then((_success) => {
      console.log(_success)
      }).catch((_error) => {
        console.log(_error)
      })
  } 
  else {
    console.log("Google Analytics plugin could not be loaded.");
    //  this.showToast("Google Analytics plugin not Found!");
  }
  GoogleAnalytics.startTrackerWithId(Analytics_id, 30).then(() => {
  console.log('GoogleAnalytics startTrackerWithId');
  GoogleAnalytics.setUserId(googleuserid);
  }).catch((e) => { this.showToast("Err!"); });
  GoogleAnalytics.enableUncaughtExceptionReporting(true)
    .then((_success) => {
    }).catch((_error) => {
      this.showToast("Err GA!");
    });
  //-------------------------------------------------
  //set the default lb setting if app works first time
 
  //this.setDefault();
   


  }

      Transition () {

      let options: NativeTransitionOptions = {
          direction: 'up',
          duration: 500,
          slowdownfactor: 3,
          slidePixels: 20,
          iosdelay: 100,
          androiddelay: 150,
          fixedPixelsTop: 0,
          fixedPixelsBottom: 60
        };


      this.nativePageTransitions.slide(options);
            }

ionViewWillLeave() {
   //  this.Transition();
   //this.Language();
  // this.showToast("Language  ionViewWillLeave :");
}
ionViewWillEnter() {
   
  //this.Language();
  //this.showToast("Language  ionViewWillEnter :");
}
    
private menuToggle()
{
  this.Language();
}
private Language()
{
  /*Commented for App preference Removal
  if (this.platform.is('cordova')) {
    this.appPreferences.fetch('language').then((res) => { console.log(res);
  //  this.showToast("Language :"+res);
    if(res=="ML")
    {
      this.language=true;
    }
    else
    {
      this.language=false; 
    }
    });  }
    else
    {
      this.language=false;
    }
   */

  }


openPage(page) {
                  /*
                  if (this.platform.is('cordova')) {
                    //Commented for App preference
                  this.appPreferences.fetch('deviceguuid').then((res) => { console.log(res);
                  // this.showToast("Device ID :"+res);
                  });     
                  this.Language();
                            
                  }else{
                    this.showToast("Cordova not available!");
                  }
                  */
              let options: NativeTransitionOptions = {
                        direction: 'up',
                        duration: 500,
                        slowdownfactor: 3,
                        slidePixels: 20,
                        iosdelay: 100,
                        androiddelay: 150,
                        fixedPixelsTop: 0,
                        fixedPixelsBottom: 60
                      };
            
            if(this.language)
            {
              this.title=page.titleM;
            }
            else
            {
              this.title=page.title;
            }
        
            if(this.global1.navPage!=page.component.name)
            {
            // this.showToast("not Equal");
            this.global1.navPage = page.component.name;
              if (page.component == SettingsPage) {
                
                                      // this.global1.presentLoadingCustom();
                                    window.setTimeout(() => {
                                      //this.nav.push(page.component);
                                    
                                      this.nav.push(page.component);
                                  
                                            
                                      }, 2);
                            }
                            else {
                                  this.nav.push(page.component); 
                                  //this.showToast("Page :"+page.component.name);
                            }  
        
                            
              
            }else
            {
              //this.showToast(" Same Page");
              console.log(" Same Page Requested");
            }
     
     

 }
}





#8

Yes I think. @bwhiting he advise same manner.


#9

This is all one file? I don’t know where to start. You need to factor your code out into modules, follow best practices. It will be much easier to debug.


#10

Sorry I don’t get your point …


#11

Angular recommends that (1) no file should be longer than 300 lines, and (2) most files should be much shorter.

My opinion: app.component.ts, in particular, should be 75 lines maximum.


#12

I would suggest you could factor out a service for:

  • network connection logic
  • google analytics logic
  • authentication logic
  • you have NativeTransitionOptions objects that look like they’re duplicated, maybe you should factor that into a separate variable and keep in in a separate file, maybe with other configuration

#13

Hello anespa,

I am a bloody beginner with ionic and related stuff, so…

I would look to main.js line 4721 if there is anything what gives a hint.

I have often problems with ‘old stuff’ that shouldn’t be. May it helps when you delete content of www folder and content of .scourcemaps. This helps sometimes by unexpeted failures.

The messages itselfs points not to obvious failure (from my knowledge). I use lazy loaded pages, so all non global imports goes to the specific lazy loaded page (only native, providers and some special things stay in appmodule). That makes my appmodule small to around 70 lines. Maybe this could help to find the failure.

As far as I know should a wrong import path leads to failure before build, but to clarify: If you use a wrong import path, then it is shown as red underlined line in your ide? Also a correct path but a wrong entry in {} brackets is marked with a red underline?

Sorry that I could not help more.

Best regards, anna-liebt


#14

Hello @anna_liebt,

I do as per , but now also same issue . Please advise

Thanks
Anes


#15

Hi @AaronSterling
I am working on an existing project which works fine . removing some lines as you suggest is impossible , please tell another suggestion

Thanks
Anes


#16

observing this I’ve found that you are using HttpModule and HttpClientModule both in your app. from reference of the answer on SO, it is recommended to use angular/http for angular apps.

Try removing HttpModule from your imports in app.module.ts


#17

Dear @Heenavora

I try according to your advise . But still issue. In my current app use both … So that’s not issue now…

Thanks
Anes


#18
imports: [
        BrowserModule,
        HttpModule,
        AboutPageModule,
        ContactPageModule,
        TabsPageModule,
        ProgressBarModule,
        WelcomePageModule,
        LocalbodyListPageModule,
        DownloadPageModule,
        OfflinePageModule,
        SettingsPageModule,
        InfoPageModule,
        VerificationPageModule,
        VerificationResultPageModule,
        GovtorderPageModule,
        SearchPageModule,
        SearchbarPageModule,
        GosearchPageModule,
        LoginPageModule,
        SharePageModule,
        ,
        LbsettingsPageModule,
        CrsearchPageModule,
        CrsearchviewPageModule,
        OnlineservicePageModule,
         HttpClientModule,
         PropertyTaxSettingsPageModule,

   IonicModule.forRoot(MyApp,
    {
        backButtonText: '',

        iconMode: 'ios',
        modalEnter: 'modal-slide-in',
        modalLeave: 'modal-slide-out',
        tabsPlacement: 'bottom',
        pageTransition: 'ios',
    }),
    IonicStorageModule.forRoot()
  ]

check your code there is an extra comma after SharePageModule. Remove that.
Try following good coding practices so that silly errors like this can not happen and get easily identified. :slightly_smiling_face:


#19

Yes @Heenavora, Your answer give solution to me.

that line is you pointed out

SharePageModule,
        ,

Thanks alot

Anes