In the Event 1 component, there is a variable that holds a string from another variable in the data.service. I want to update the data.service string to 'Event 2' when the Event 2 component loads.
I have attempted to implement the following code without success. I have tried calling it in ngAfterViewInit and from a button as well.
Event 1 Component:
public Title = this.dataservice.Title;
Data.service:
public Title = "Event 1";
Event 2 Component:
changeTitle(){
this.dataService.Title = 'Event 2';
console.log("CHANGE TITLE");
}
ngAfterViewInit(): void {
this.changeTitle();
}