How can I access an element in my component template from my js code?
Suppose I have many components with this template:
<div style="width: inherit; height: inherit;">
<img class="elem"> </img>
</div>
and I want each component's controller to access its own img - how can I do it?
You can inject $element into your component controller:
componetnController($element) {
let img = $element.find('img');
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With