【问题标题】:angular 2 webpack-dev-server , routing not workingangular 2 webpack-dev-server,路由不起作用
【发布时间】:2017-03-05 17:48:36
【问题描述】:

我安装了webpack,一切都很好,但是路由不再工作了,

export const appRoutes: Routes = [
  { path: '', pathMatch: 'full', redirectTo: 'main' },
  { path: 'login', component: LoginComponent },
  { path: 'main', component: mainPage },
  { path: 'verification', component: Verification },
  { path: 'profile', component: Profile },
  { path: 'search', component: Search },
  { path: 'userProfile', component: UserProfile },
];

在我安装 webpack 之前,路由工作正常

【问题讨论】:

  • 您遇到的错误是什么?
  • 已经找到解决方案,我将其发布为答案

标签: angular webpack webpack-dev-server


【解决方案1】:

我发现我的错误,而不是 "start": "webpack-dev-server",在 package.json 我使用,"start": "concurrently \"npm run build:watch\" \"npm run serve\" ",

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-06-12
    • 2017-05-05
    • 2016-09-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多