I have two functions in two differents components, I'd like to share functions between them but I don't understand how to do and applicate it in my project. In a component, I have a getDatasFromMainTable(). And on the other one, I have a getDatasFromArchiveTable(). I tried :
@Input() myFirstComponent!: MyfirstComponent;
and in a function:
this.myFirstComponent.getDatasFromArchiveTable();
But I have a message
Cannot read properties of undefined (reading 'getDatasFromArchiveTable')
I read a lot of things about behaviorSubject, or @Input(), @ViewChild() or onChanges... But I don't know how to applicate it to my project if I need it for this.