I am trying to pass the string value of this.title
from my LandingPage.component to my ResultPage.component.
I retrieve the list.show
value
Make the title a public property of the service like this:
// this gives us the name of the clicked show, which we send to TitleResolver
@Injectable()
export class TitleService {
selectedTitle: string;
fetchTitle(title) {
console.log("title is " + title); // this outputs correctly
this.selectedTitle = title;
return title; // No need to return it.
}
}
Then any other component can inject this service and access this.titleService.selectedTitle