我是角度2开发的新手,我正在使用路由模块构建应用程序。
当我用ng服务运行它时,我可以在不同的组件之间移动,
但当我使用" ng build
"或" ng build --prod
&#34;我无法看到需要展示<router-outlet></router-outlet>
的组件。
任何人都可以帮我解决这个问题吗?
当我在chrome中打开控制台时,我看到以下消息:
错误错误:未捕获(在承诺中):SecurityError:无法执行 &#39; replaceState&#39; on&#39; History&#39;:带URL的历史状态对象 &#39;文件:/// C:/用户/ tc34677 /文档/ GitHub的/ Emint-撒拔/ DIST /家&#39; 无法在原始文档中创建&#39; null&#39;和URL &#39;文件:/// C:/Users/tc34677/Documents/GitHub/Emint-Zabad/dist/index.html' ;. 错误:无法执行&#39; replaceState&#39;历史&#39;历史状态 带URL的对象 &#39;文件:/// C:/用户/ tc34677 /文档/ GitHub的/ Emint-撒拔/ DIST /家&#39; 无法在原始文档中创建&#39; null&#39;和URL &#39;文件:/// C:/Users/tc34677/Documents/GitHub/Emint-Zabad/dist/index.html' ;. 在BrowserPlatformLocation.webpackJsonp ... / .. / .. / platform-browser/@angular/platform-browser.es5.js.BrowserPlatformLocation.replaceState (平台browser.es5.js:1925) 在PathLocationStrategy.webpackJsonp ... / .. / .. / common/@angular/common.es5.js.PathLocationStrategy.replaceState (common.es5.js:640) at Location.webpackJsonp ... / .. / .. / common/@angular/common.es5.js.Location.replaceState (common.es5.js:321) 在router.es5.js:4163 在SafeSubscriber._next(Observable.js:224) 在SafeSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.SafeSubscriber .__ tryOrSetError (Subscriber.js:247) 在SafeSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.SafeSubscriber.next (Subscriber.js:187) 在Subscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.Subscriber._next (Subscriber.js:125) 在Subscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.Subscriber.next (Subscriber.js:89) 在MapSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / operator / map.js.MapSubscriber._next (map.js:83) 在BrowserPlatformLocation.webpackJsonp ... / .. / .. / platform-browser/@angular/platform-browser.es5.js.BrowserPlatformLocation.replaceState (平台browser.es5.js:1925) 在PathLocationStrategy.webpackJsonp ... / .. / .. / common/@angular/common.es5.js.PathLocationStrategy.replaceState (common.es5.js:640) at Location.webpackJsonp ... / .. / .. / common/@angular/common.es5.js.Location.replaceState (common.es5.js:321) 在router.es5.js:4163 在SafeSubscriber._next(Observable.js:224) 在SafeSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.SafeSubscriber .__ tryOrSetError (Subscriber.js:247) 在SafeSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.SafeSubscriber.next (Subscriber.js:187) 在Subscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.Subscriber._next (Subscriber.js:125) 在Subscriber.webpackJsonp ... / .. / .. / .. / rxjs / Subscriber.js.Subscriber.next (Subscriber.js:89) 在MapSubscriber.webpackJsonp ... / .. / .. / .. / rxjs / operator / map.js.MapSubscriber._next (map.js:83) at resolvePromise(zone.js:795) at resolvePromise(zone.js:766) 在zone.js:844 在ZoneDelegate.webpackJsonp ... / .. / .. / .. / zone.js / dist / zone.js.ZoneDelegate.invokeTask (zone.js:425) at Object.onInvokeTask(core.es5.js:3881) 在ZoneDelegate.webpackJsonp ... / .. / .. / .. / zone.js / dist / zone.js.ZoneDelegate.invokeTask (zone.js:424) 在Zone.webpackJsonp ... / .. / .. / .. / zone.js / dist / zone.js.Zone.runTask(zone.js:192) 在drainMicroTaskQueue(zone.js:602) 在defaultErrorLogger @ core.es5.js:1020