You are on page 1of 1

Create routes just like instructed here.

Set up your app-routing.module.ts ( or just put it in app.module.ts ), place the


<router-link> in your app.component.html.

Now, to open a new window from the main page, ( or whatever sub-routes you have
created ) just call a function, handled in the main component, that will point to
the url of the sub-component route that you setup for the new window.

Example snippits:
app-routing.ts

import { NgModule } from '@angular/core';


import { RouterModule, Routes } from '@angular/router';

import { MainComponent } from './main/main.component'; // main window


import { JclInfoComponent } from './jcl-info/jcl-info.component'; // new window/tab

const appRoutes: Routes = [


{ path: '', component: MainComponent }, // main route
{ path: 'openJcl', component: JclInfoComponent } // new window route
];

@NgModule({
imports: [
RouterModule.forRoot( appRoutes )
],
exports: [
RouterModule
]
})
export class AppRoutingModule {}
app.component.html

<router-outlet>
<!-- Just showing you that you can put things inside this. -->
<template ngbModalContainer></template>
</router-outlet>
main.component.html

<button (click)="testMe()">myLabel</button>
main.component.ts

public testMe() {
window.open( "openJcl" );
}

You might also like