I'm currently learning Angular 4 but I'm wondering if I can access one component's data from *.component.ts from another *.component.ts.. what do I mean? I have the following structure
app
first-component
first-component.html
first-component.ts
second-component
second-component.html
second-component.ts
app(main)-component
So If I have for example the following array of strings in first-component :
labels: any[] = ['Name' , 'Address' , 'Photo' , 'Date' , 'Session' , 'Description'];
Is there a way to access that array from my second-component.ts and to do something like this when labels array is declared in my first-component.ts?
second-component =>
pushItemsToArray() {
this.labels.push(item);
}
So If I have a form in my second-component and want to render the data in my first-component , how that happens? Thank you and sorry if the question is duplicate of another one, but I've been searching for a lot of time and couldn't find the things I was searching for..