Reputation: 2110
What is the angular way of creating a canvas element in AngularJS custom directive.
document.createElement('canvas') Not Angular Way
$document.createElement('canvas') Error $document.createElement('canvas') is not a function angular.element('canvas') Error related jqLite
Upvotes: 1
Views: 1270
Reputation: 8484
Create element in plain javascript and make it angular. angular.element
is to use JQLite methods on element in it but not to create element
var canvas = angular.element(document.createElement('canvas'));
to see the element created by above line, just log the canvas
console.log(a);
console.log(a[0]);
And above element creation line creates only opening tag until it contains a child. So, try to append child to get closing tag
Upvotes: 1