Angular 角度2+;静态html的路径

Angular 角度2+;静态html的路径,angular,angular-routing,angular-router,Angular,Angular Routing,Angular Router,在我的Angular 2+应用程序中,我需要显示静态html文件内容。因此,我将静态html(helper.html)放在assets文件夹中,我可以通过以下方式访问它: http://localhost:4200/assets/helper.html 但是,当我引入路由模块时,我得到了以下错误: Error: Cannot match any routes. URL Segment: 'assets/static/helper.html' noMatchError 我需要在路由模块中执行什

在我的Angular 2+应用程序中,我需要显示静态html文件内容。因此,我将静态html(helper.html)放在assets文件夹中,我可以通过以下方式访问它:

http://localhost:4200/assets/helper.html
但是,当我引入路由模块时,我得到了以下错误:

Error: Cannot match any routes. URL Segment: 'assets/static/helper.html' noMatchError
我需要在路由模块中执行什么操作才能使此路径正常工作

PS:下面是我的路由模块的一个片段:

const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full'},
  { path: 'home', component: HomeComponent }
]

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule { }

此html必须包含一个组件。没有它是不行的。

为它添加一个组件文件并为它设置一个url

静态组件

import {Component} from '@angular/core'
@Component({
    templateUrl:'helper.html'
})
export class StaticComponent{
}
app-routing.module.ts

import {StaticComponet} from '../assets/static.component.ts';
const routes: Routes = [
  { path: '', redirectTo: 'home', pathMatch: 'full'},
  { path: 'home', component: HomeComponent },
{path:'helper',component:StaticComponent}
]

@NgModule({
  imports: [ RouterModule.forRoot(routes) ],
  exports: [ RouterModule ]
})
export class AppRoutingModule { }

您必须将其添加到routing.module,如动态页面。如果您可以将routing.module发布为well@hana_wujira您能告诉我如何将其添加到路由模块吗?抱歉,无法使用此方法,因为helper.html有自己的
标记