I have two components, class ChatPage and HomePage.
Class ChatPage has a big constructor due to injecting many services, and an array:
IonicPage()
@Component({
selector: 'page-chat',
templateUrl: 'chat.html',
providers: [ChatService]
})
export class ChatPage implements OnInit, OnDestroy{
msg:any[];
Class HomePage, which is another component:
@Component({
selector: 'page-home',
templateUrl: 'home.html',
providers: [ChatService]
})
export class HomePage {
chatRoot = ChatPage;
settingsRoot = SettingsPage;
constructor(private chatService: ChatService) {
}
onReset(){
//this.chatRoot.msg = [];
}
}
I want to reset the msg to [].
However, in the current state I get a complaint that msg is not known.