typescript 应用路由模块。
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了typescript 应用路由模块。相关的知识,希望对你有一定的参考价值。
...
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
...
import { ComponentName } from './pathtocomponent';
@NgModule({
...
imports: [
...
AppRoutingModule
],
]
})
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { ComponentName } from './pathtocomponent';
const appRoutes: Routes = [
{ path: '', component: ComponentName'},
/*{ path: 'not-found', component: PageNotFoundComponent },
{ path: '**', redirectTo: '/not-found' }*/
];
/* @NgModule Transform this file in an angular module*/
@NgModule({
imports: [RouterModule.forRoot(appRoutes)], /* Register router in the app*/
exports: [RouterModule] /* Exports the router module */
})
export class AppRoutingModule {
}
以上是关于typescript 应用路由模块。的主要内容,如果未能解决你的问题,请参考以下文章
typescript Angular 2+:路由模块
如何在 Vue.js - Nuxt - TypeScript 应用程序中访问路由参数?
Mocha + TypeScript:不能在模块外使用导入语句
vue-cli3+typescript+路由懒加载报错问题
AngularJS Typescript 路由
typescript 带有ReactiveForms的应用程序模块