Load a component into another template

Asked

Viewed 76 times

1

I have an angle app with a Drawer. The application usually works by displaying its contents in the Drawer/content central panel.

inserir a descrição da imagem aqui

However, by clicking on a button you need to open a new tab in the browser but displaying another component in a template other than the default one.

From what I understand I must change the route module specifying a daughter route so that the component uses a router-outlet of another component, and not the standard component (app.Component). For this I created a "Clearlayoutcomponent" with a router-outlet only, and specified in the route module that the "patient/:id" route should use the "Clearlayoutcomponent" template".

const routes: Routes = [

{
path: 'pessoas',
component: ListaPessoasComponent,
data: { title: 'Pessoas' }
},
{
path: '',
component: ClearLayoutComponent,
children: [
{
     path: 'paciente/:id',
     component: PacienteComponent,
     data: { title: 'Paciente' }
}]}];

The method I call to open the tab is this:

 Editar(id:number){
 window.open(`./paciente/${id}` ,"_blank");
 }

Everything works, but still the template of the app.Component is displayed in the new tab.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.