I am trying to get an element inside an AngularJS controller like this:
var imageInput = document.getElementById("myImage");
It doesn't work, the element is null. However if I move the statement to a function that I bound with ng-click
it works. Why? and how do I fix it?