I am facing an issue with a component that contains a variable called myName
export class ConversationComponent implements OnInit {
private myName: string;
showNames(name)
{
this.myName=name;
}
}
The value is assigned using the showNames()
method, and it should be displayed as follows:
<h4>{{MyName}}</h4>
However, I noticed that when the value of the variable is changed, it is not reflected in the HTML view.
Below is an excerpt from my Service:
import { Injectable } from '@angular/core';
import { ConversationComponent } from './conversation/conversation.component';
@Injectable() export class ChatingService {
constructor(private Conversation:ConversationComponent) { }
setValue(val) {
this.Conversation.showNames(this.myValue);
}
}