I need the dimensions of an image loaded from the web (dynamically) to adapt my display. So I need to use an onload event in the controller (the view is not rendered yet), like so :
.controller("MyCtrl", function($scope){
img.onload = function () {
// $scope changes not effective
}
I know I could use $apply, but I'm not a huge fan of it since it hurts performances. Do you have any other solution I could use, whether for Angular to be aware of what I'm doing (which is not the case with img.onload) or for the scope to take my changes into account?
Thanks!
img.onload