1
在浏览器控制台中查看例外情况。在Angular2中获取异常EXCEPTION:没有PlatformLocation的提供者?
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]
请帮忙解决这个问题。不完全理解什么是问题。
下面是index.ts我引导我的应用程序。
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 })]);
我使用角度2.0.0-rc.1版本(发布候选版本)不稳定的版本。 –