Within my directive, I have a template that includes an <img>
element and I am trying to run a custom method from the directive's scope:
<my-directive>
<!-- Template for my directive -->
<p>...</p>
<img onload="myScopeMethod()">
<p>...</p>
<!-- Template for my directive -->
</my-directive>
I came across this solution on
Get width height of remote image from url, but it only works if applied to a directive targeting the <img>
element.
The main goal of the directive is to display a widget that enables image manipulation (scaling by dragging a slider), therefore I need to retrieve the original size of the image somehow.
Is there a way for me to trigger the method from my controller's scope?