In my app.component.html I have a structural markup for navigation and a main area where I intend to render in different things from other components.
<navbar (onPopup)="popup.show($event);">NavBar</navbar>
<sidebar>SideBar</sidebar>
<popup #popup>Popup</popup>
<mainarea>MainArea</mainarea>
The idea is to create a bunch of components that target the same selector (i.e. mainarea) but show entirely different templates. So, I'd have something like this.
// ./demo1/demo-x.ts
import { Component } from "@angular/core";
@Component({ selector: "mainarea", template: require("./demo-x.html") })
export class DemoX { constructor() { console.log("Demo X"); } }
But also (note that the selector targets the same tag on the page) something like this.
// ./demo2/demo-y.ts
import { Component } from "@angular/core";
@Component({ selector: "mainarea", template: require("./demo-y.html") })
export class DemoY { constructor() { console.log("Demo Y"); } }
In the menu system, the idea is to receive a click from the user and, depending on what they clicked, load in the correct page into the holder tag mainarea.
At the moment, it's fails, because Angular doesn't like the two different components to be rendered in the same selector. I see the problem and I suspect that I might have started off based on a flawed idea to begin with.
I sense that routing might be a good idea but straight off, I can't see how to incorporate it into the menu system. Only the portion of the site that's contained in mainarea control is supposed to be updated while the rest shouldn't change (and definitely not be reloaded).