0
I was wondering if it’s possible to pass a function through two way data bind angular. I will try to explain, I have a component with 3 buttons and I would like to use them in several parts of my project. Wanted can pass the functions to the buttons run, I will try to give an example.
component where I want to implement my buttons:
<div>
<component-btns [(botao1)]="funcao1" [(botao2)]="funcao2" [(botao3)]="funcao3"><component-btns>
</div>
These functions will be received in my component-btns
and referenced to buttons in my html.
If I perform the functions and ask for one console.log(this)
what will be printed is the this
of my component-btns
and not the this
that I used to implement and pass on the functions to my component-btns
.
It’s very confusing what I want to do, I wonder if it’s possible to do something like this?
It worked perfectly, I was trying to do it in a completely different way, you saved my rsrs day, thank you very much
– Erick Zanetti
Available, the documentation of Angular helps a lot, when you can give a read, it has quite interesting thing.
– Marcus Hert da Coregio