码迷,mamicode.com
首页 > 其他好文 > 详细

angular打包后路由和文件路径不对

时间:2019-03-19 10:21:18      阅读:301      评论:0      收藏:0      [点我收藏+]

标签:err   ack   文件   angular   router   eval   ror   with   tor   

base href换成如下script标签

  <!-- <base href="/"> -->
  <script>
    document.write(<base href=" + document.location + " />);
  </script>

在app.module.ts下添加 { provide: LocationStrategy, useClass: HashLocationStrategy }

providers: [
    HttpErrorHandler,
    httpInterceptorProviders,
    CookieService,
    { provide: NZ_I18N, useValue: zh_CN },
    { provide: RequestCache, useClass: RequestCacheWithMap },
    { provide: RouteReuseStrategy, useClass: CustomReuseStrategy },
    { provide: LocationStrategy, useClass: HashLocationStrategy }
  ]

搞定!

angular打包后路由和文件路径不对

标签:err   ack   文件   angular   router   eval   ror   with   tor   

原文地址:https://www.cnblogs.com/sooooogiotto/p/10556691.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!