After experimenting with the code on JSBin, I noticed that the first snippet successfully retrieved the canvas object, while the second one did not.
JSBin: http://jsbin.com/natavejasa/1/edit?html,js,output
var canvas = $window.document.getElementById('myCanvas');
JSBin: http://jsbin.com/yareb/1/edit?html,js,output
var canvas = $document.getElementById('myCanvas');
This leads me to ponder over the distinction between $window.document
and $document
.