I have 2 components, onclick of button of 1st component the value (any string) should be added to the array of the 2nd component. How can i achieve this? I work on angular 4.
@Component({
selector: 'app-sibling',
template: `
{{message}}
<button (click)="newMessage()">New Message</button>
`,
styleUrls: ['./sibling.component.css']
})
newMessage() {
console.log("button clicked");
}