I have multiple components along with their html pages and each page contains a title, type of page(subtitle), and id. Now instead of having this info added to every page i wanted to create a component which will contain this specific info and add it as a selector into all the components that way i could unify and control the structure on each page. I will also need to make some of the content route to another page upon click.
The way i am viewing it is that the DetailComponent which will contain the title, subtitle and id will be considered as a parent component i believe (?) and that from all the other pages i will be emitting the required info as child components. Correct me if i am wrong. Not sure if this structure i want is parent-child relationship or siblings.
So in a child component html page i would have:
<detail-component [pagetitle] = "page.title" [pageId]="page.id"></detail-component>
in child component.ts:
@Output()
public pageInfo: new EventEmitter<any>();
this.pageInfo.emit({...})
in the DetailComponent.html:
<div>
<h1>{{page.title}}</h1>
<h2>{{page.subTitle}} " - " {{page.Id}}</h2>
</div>
I am a little lost in connecting all this together to get what i want and any help will be appreciated.
Example of a page and i have five pages like this and each html page is being populated from it component:
<div class="pageInfo">
<h2>{{Title}}Title of this page here</h2>
<h3>{{ID}}:{{Subtitle}} Subtitle of page here</h3>
</div>
I would like to move this html into the parent html page and then from each of the child components i would emit the info i need like the title, id and subtitle to the parent component and from within the child html page i would replace the title info html with