Liferay 7.1 Angular 5 Portlet路由器出口

时间:2018-12-05 17:13:29

标签: angular liferay portlet liferay-7

im尝试使用RouterModule部署Angular 5 portlet。我无法分别加载每个组件,但是当使用路由器出口时,我的组件无法加载。

¿我做错什么了吗?

app.module.ts

const rootRouterConfig: Routes = [
    { path: '', component: MapComponent },
    { path: 'detail', component: DetailComponent}
    ];

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        RouterModule.forRoot(rootRouterConfig, { useHash: true })
    ],
    declarations: [
        AppComponent, DetailComponent, MapComponent, SearchComponent
    ],
    entryComponents: [AppComponent, DetailComponent, MapComponent, SearchComponent],
    bootstrap: [], // Do not bootstrap anything (see ngDoBootstrap() below)
    providers: [{provide: APP_BASE_HREF, useValue : '/' }],
    exports:[RouterModule]
})

export class AppModule {

    // Avoid bootstraping any component statically because we need to attach to
    // the portlet's DOM, which is different for each portlet instance and,
    // thus, cannot be determined until the page is rendered (during runtime).

    ngDoBootstrap() {}
}

app.component.ts

@Component({
    selector: 'app-component',
    template: `
        <router-outlet></router-outlet>
    `,
})
export class AppComponent{
    constructor(private router:Router){

    }
}

日志中没有例外。

0 个答案:

没有答案