First angularjs directive
Angular includes a tiny subset of jQuery called jqLite which is what you get with angular.element.  The html() method on it specifically only accepts a string, not an array of jqLite objects like jQuery normally does I think (unless it's a bug).

One solution would be to use jquery.  If you include jquery before angular, angular will use your jquery instead of the embedded jqlite.  Swap the script tags in this fiddle to see it toggle between working and not.

Another solution would be to use the outerHTML of your canvas element's html node like in this fiddle:

tElement.html(canvasElement[0].outerHTML);


I think using canvasElement[0] is fine.