When the app logins
As soon as it reaches navigates this error shows up
UNTIL console.log("NAVIGATE");
IT WORKS FINE BUT AFTER THIS IT THROWS ERROR . Cant get the issue. Tried all the ways to navigate but the error comes.
HTTP Request completes successfully. Rather this code works fine on the normal debug build. But whem I try with either --prod or --release.
this.auth.login(form)
.subscribe(res => {
console.log('res',res,res._body);
res=JSON.parse(res._body);
console.log('Jres',res);
if (res.token)
{
this.storage.set('auth-token', res.token).then(()=>{
this.auth.checkToken()
});
this.storage.set('user', res.user).then(()=>{
this.auth.checkToken()
});
this.globalService.user=res.user;
this.globalService.auth_token=res.token;
console.log("NAVIGATE"); // <------UNTIL HERE IT WORKS FINE BUT AFTER THIS IT THROWS ERROR . Cant get the issue. Tried all the ways to navigate but the error comes.
//this.router.navigateByUrl('/map-all-location');
this.navCtrl.navigateRoot('/map-all-location');
main.ae4b78b1d85092fcf459.js:1 ERROR Error: Uncaught (in promise): Error: StaticInjectorError[l -> e]:
StaticInjectorError(Platform: core)[l -> e]:
NullInjectorError: No provider for e!
Error: StaticInjectorError[l -> e]:
StaticInjectorError(Platform: core)[l -> e]:
NullInjectorError: No provider for e!
App.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouteReuseStrategy } from '@angular/router';
import { FileTransfer, FileUploadOptions, FileTransferObject } from '@ionic-native/file-transfer/ngx';
import { AuthenticationService} from './services/authentication.service';
import {GlobalService} from './services/global.service';
import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
import { SplashScreen } from '@ionic-native/splash-screen/ngx';
import { StatusBar } from '@ionic-native/status-bar/ngx';
import { IonicStorageModule } from '@ionic/storage';
import { ReactiveFormsModule} from '@angular/forms';
import { HttpClientModule } from '@angular/common/http';
import { HttpModule } from '@angular/http';
import { FullnessPage } from './page/fullness/fullness.page';
import { SignupPage } from './page/signup/signup.page';
import { CollectionDetailPage } from './page/collection-detail/collection-detail.page';
import { AppComponent } from './app.component';
import { AppRoutingModule } from './app-routing.module';
@NgModule({
declarations: [AppComponent,FullnessPage,SignupPage,CollectionDetailPage],
entryComponents: [FullnessPage,SignupPage ,CollectionDetailPage],
imports: [BrowserModule
, IonicModule.forRoot()
, AppRoutingModule
,IonicStorageModule.forRoot()
,ReactiveFormsModule
,HttpModule
,HttpClientModule,
],
providers: [AuthenticationService,GlobalService,
FileTransfer,
StatusBar,
SplashScreen,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy }
],
bootstrap: [AppComponent]
})
export class AppModule {}
I have tried to implement the http method but that is not the issue I guess as the error is thrown when the app needs to navigate.