import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './home/home.component';
import {NavabrComponent} from './navber/navbar.component';
const routes: Routes = [
{path: '' redirectTo: '/home', pathMatch:'full'},
{path: 'home', component:HomeComponent}
];
@NgModule({
imports: [
CommonModule,
RouterModule.forRoot(routes, { useHash: true })
],
exports:[RouterModule],
declarations: []
})
export class AppRoutingModule { }
一些东西在我的网页上改变,它运行服务器--> error in src/app/app-routing.module.ts(10,11):ERROR TS1005:',‘expected.it每次运行项目时都会显示这个错误这个错误将被displayed.how来解决这个错误?
发布于 2019-03-20 04:13:10
此行缺少逗号
{path: '', redirectTo: '/home', pathMatch:'full'},
发布于 2018-07-20 13:21:03
编译器会告诉你你应该知道的一切,在这里提问之前,请考虑更深入地研究一下。在本例中,在path
和redirectTo
之间添加逗号(,)。
https://stackoverflow.com/questions/51435520
复制相似问题