Ok - I've got it working in Visual Studio 2017 with the latest SPA Templates for dotnetcore2 and I will paste in the code for each of the sections that need to be in sync for this to be functional.
The variable names are very long so that its easier to track or follow what is where and why its there. Hope this helps
In the App component ts file I have the following code that defines a property for the page title:
export class AppComponent {
strVarPageTitleFromAppComponent: string = 'Page Title - Parent App';
}
In the App Component HTML the Input hook is defined and it leverages this variable from the App component:
<div class='col-sm-3'>
<nav-menu [pageTitleInputFromParentComponentToChildComponent]="strVarPageTitleFromAppComponent"></nav-menu>
</div>
Then in the Nav Component Typescript file add the Input and property as shown below:
import { Component, Input } from '@angular/core';
@Component({
selector: 'nav-menu',
templateUrl: './navmenu.component.html',
styleUrls: ['./navmenu.component.css']
})
export class NavMenuComponent {
@Input('pageTitleInputFromParentComponentToChildComponent') pageTitleVarFromNavComponent: string;
}
Finally, the variable defined in Typescripts for the Child (Nav) component is leveraged in the HTML display template for that component:
<li [routerLinkActive]="['link-active']">
<a [routerLink]="['/home']">
<span class='glyphicon glyphicon-home'></span> {{pageTitleVarFromNavComponent}}
</a>
</li>
Hope that helps