Getting below on exception in browser console.
EXCEPTION: Error: Uncaught (in promise): EXCEPTION: Error in :0:0
ORIGINAL EXCEPTION: No provider for PlatformLocation!
ORIGINAL STACKTRACE:
Error: DI Exception
at NoProviderError.BaseException [as constructor] (http://localhost:3000/lib/@angular/core/core.umd.js:3776:27)
at NoProviderError.AbstractProviderError [as constructor] (http://localhost:3000/lib/@angular/core/core.umd.js:4307:20)
at new NoProviderError (http://localhost:3000/lib/@angular/core/core.umd.js:4342:20)
at ReflectiveInjector_._throwOrNull (http://localhost:3000/lib/@angular/core/core.umd.js:5794:23)
at ReflectiveInjector_._getByKeyDefault (http://localhost:3000/lib/@angular/core/core.umd.js:5822:29)
at ReflectiveInjector_._getByKey (http://localhost:3000/lib/@angular/core/core.umd.js:5785:29)
at ReflectiveInjector_.get (http://localhost:3000/lib/@angular/core/core.umd.js:5594:25)
at _View_WalletPlus_Host0.createInternal (WalletPlus_Host.template.js:38:83)
at _View_WalletPlus_Host0.AppView.create (http://localhost:3000/lib/@angular/core/core.umd.js:9862:25)
at _View_WalletPlus_Host0.DebugAppView.create (http://localhost:3000/lib/@angular/core/core.umd.js:10054:48)
ERROR CONTEXT:
[object Object]
Please help to resolve this. Not understanding what is the issue exactly.
below is index.ts where i am bootstrapping my application.
import {bootstrap} from "@angular/platform-browser-dynamic";
import {enableProdMode,provide} from "@angular/core";
import {ROUTER_PROVIDERS} from "@angular/router";
import {HTTP_PROVIDERS} from "@angular/http";
import {MyAppComponent} from "./components/MyApp.component";
import {SimpleExpiry} from 'ng2-idle/simpleexpiry';
import {APP_BASE_HREF, LocationStrategy, HashLocationStrategy} from "@angular/common";
enableProdMode();
bootstrap(<any>MyAppComponent, [ROUTER_PROVIDERS, HTTP_PROVIDERS,SimpleExpiry,
provide(APP_BASE_HREF, { useValue: "/" }),
provide(LocationStrategy, { useClass: HashLocationStrategy })]);
You must be missing NativeScriptRouterModule
inside imports the in main.ts file.
import { NativeScriptRouterModule } from "nativescript-angular/router";
import { NativeScriptFormsModule } from "nativescript-angular/forms";
@NgModule({
declarations: [
AppComponent,
routableComponents,
],
bootstrap: [AppComponent],
imports: [
NativeScriptModule,
NativeScriptFormsModule,
NativeScriptRouterModule,
NativeScriptRouterModule.forRoot(routes),
],
})
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.