[英]You may need an appropriate loader to handle this file type. error in Angular 5 app
I just started learning angular 5. Now I got the below error 我刚刚开始学习角度5。现在出现以下错误
Failed to compile.
编译失败。
./src/app/route/app.routing.ts Module parse failed: Unexpected token (4:28) You may need an appropriate loader to handle this file type. | Object.defineProperty(exports, "__esModule", { value: true }); | var appRoutes = [ | { path: '', component: } | ]; | @ ./src/app/app.module.ts 11:20-50 @ ./src/main.ts @ multi (webpack)-dev-server/client?http://0.0.0.0:0 ./src/main.ts
import { RouterModule, Routes } from '@angular/router';
import { ProductListComponent } from '../product-list/product-list.component';
const appRoutes : Routes = [
{path: '', component: ProductListComponent, pathMatch:'full'},
{path:'product-list', component: ProductListComponent, pathMatch: 'full'},
{path: '**', redirectTo: ''}
];
export const routing = RouterModule.forRoot(appRoutes);
I couldn't find out what does the error really mean.Please help 我无法确定错误的真正含义。请帮助
try redirectTo 尝试redirectTo
const appRoutes : Routes = [
{path: '', redirectTo: '/product-list', pathMatch: 'full'},
{path:'product-list', component: ProductListComponent, pathMatch: 'full'},
{path: '**', redirectTo: ''}
];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.