Adding new route to Jhipster using Angular 4

为君一笑 提交于 2019-12-06 09:30:52
Natuto83

You may need to load your router somewhere.

Try perform the following:

  1. Add a user-profile.module.ts in to the same directory as your user profile component:


    import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
    import { RouterModule } from '@angular/router';

    import { UserProfileComponent, userProfileRoute } from './';

    @NgModule({
        imports: [
            RouterModule.forRoot([ userProfileRoute ], { useHash: true })
        ],
        declarations: [
            UserProfileComponent,
        ],
        entryComponents: [
        ],
        providers: [
        ]
    })
    export class UserProfileModule {}

  1. In the app.module.ts, add the following:


    import { UserProfileModule } from './user-profile/user-profile.module';

and



    imports: [
        BrowserModule,
        LayoutRoutingModule,
        ...
        **UserProfileModule**
    ],

Hope it works.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!