0
私はangular2プロジェクトでhtml2canvasを使用しようとしています、私は要素を作成し、下記のように身体にキャンバスを追加します。Html2canvas + Angular2:要素をレンダリングし、キャンバスをボディに追加しますか?
let newDiv = document.createElement("div");
let newContent = document.createTextNode("Hi there and greetings!");
newDiv.appendChild(newContent);
html2canvas(newDiv).then(function(canvas) {
document.body.appendChild(canvas);
});
が、私は以下のエラーました:
EXCEPTION: Uncaught (in promise): TypeError: Cannot read property 'removeAttribute' of null TypeError: Cannot read property 'removeAttribute' of null
をどんなアイデアでもこのエラーを修正してください。
おかげで、
すでに使用されている "@タイプ/ html2canvas": "^ 0.5.33" & "html2canvas": "^0.5.0-beta4 "、 – da45
、document.bodyのレンダリング時にエラーが見つかりませんでした。私の質問は、" document.createElement "で要素を作成してレンダリングする方法です – da45