【问题标题】:ERROR in src/app/app-routing.module.ts(10,11): error TS1005: ',' expectedsrc/app/app-routing.module.ts(10,11) 中的错误:错误 TS1005:“,”预期
【发布时间】:2019-03-20 04:13:10
【问题描述】:

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 { }

我的网页上发生了一些变化,它运行服务器 --> src/app/app-routing.module.ts(10,11) 中的错误:错误 TS1005: ',' expected.it will be displayed 每次运行项目都会出现这个错误,如何解决这个错误?

【问题讨论】:

    标签: javascript html css angular jquery-ui


    【解决方案1】:

    此行缺少逗号

    {path: '', redirectTo: '/home', pathMatch:'full'},
    

    【讨论】:

      【解决方案2】:

      编译器会告诉您您应该知道的一切,在此处提问之前,请考虑进一步研究。在您的情况下,在 path 和 redirectTo 之间添加一个逗号 (,)。

      【讨论】:

        猜你喜欢
        • 2018-05-14
        • 1970-01-01
        • 2015-07-12
        • 2017-11-24
        • 1970-01-01
        • 2023-03-25
        • 2013-08-20
        • 2022-12-15
        • 2018-02-17
        相关资源
        最近更新 更多