0

I have a main page with two buttons and routing works fine. However, these two components are presented on this main page with buttons, because of <router-outlet></router-outlet>.

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8" />
    <title>Main page</title>
  </head>
  <body>
     <h1>My Page</h1>
     <button class="button_blue"><a routerLink="/pageB">1</a></button>
     <button class="button_red"><a routerLink="/pageC">2</a></button>
     <router-outlet></router-outlet>
  </body>
</html>

When I click on a main page button, how can I open my 'pageB' as complete new empty page, without any links or buttons? target="_blank" gives me the same, just on an another tab.

Hrvoje T
  • 3,365
  • 4
  • 28
  • 41
  • I don't understand, how can you click on a button on a page with no buttons? I'm not sure what you're asking. – Train Jan 28 '20 at 22:06
  • @Train Well, english is not my strong side .. I edited the question to be more clear. – Hrvoje T Jan 28 '20 at 22:16
  • when you say new page, do you mean the default page for the browser when you open it? Or a white empty page? – Train Jan 28 '20 at 22:18
  • Main page has two buttons. Clicking one button should open a new empty page with its component, without buttons and links from a main page. And all that via routerLink not href. – Hrvoje T Jan 28 '20 at 22:33
  • To render only `pageB` without the main page, you need to create another layout. Is this what you asking for? https://stackoverflow.com/questions/40508557/multiple-layout-for-different-pages-in-angular-2 Maybe you can show us some example screenshots of the output. – Train Jan 28 '20 at 22:37
  • 1
    Yes, this is what I would like to do. Thank you for the link, child route will help – Hrvoje T Jan 28 '20 at 22:58

0 Answers0