我有一个 Angular 6 应用程序,可以处理诸如“未找到页面”、“错误”、“未授权”之类的路由。
这是我的路线的样子:
const appRoutes: Routes = [
{ path:'page-not-found', component: NotFoundPageComponent },
{ path: 'unauthorized', component: UnAuthorizedPageComponent },
{ path: 'error', component: ErrorPageComponent },
{ path: '**', component: NotFoundPageComponent },
];
所有组件都有简单的 html 模板,如下所示:
<p>Page Not Found. Please report this error to system administrator </p>
<p>Unauthorized. Please report this error to system administrator</p>
<p>Error. Please report this error to system administrator</p>
一切正常,ng serve
我想在多个应用程序中使用这些路由,因此我希望将其转换为可以在许多应用程序中导入的模块或库,如下所示
import { NotFoundPageComponent } from 'routing-lib';
在我的原始应用程序中,我创建了一个带有ng g library routing-lib
. 但我不知道如何将我的应用程序与图书馆联系起来。这就是我的项目结构的样子。
有什么建议或指示吗?