AngularJS - add HTML element to dom in directive without jQuery

前端 未结 4 1512
逝去的感伤
逝去的感伤 2021-01-31 02:35

I have an AngularJS directive in which I want to add a svg tag to the current element of the directive. Right now I do this with the help of jQuery

link: functio         


        
4条回答
  •  梦谈多话
    2021-01-31 03:12

    You could use something like this

    var el = document.createElement("svg");
    el.style.width="600px";
    el.style.height="100px";
    ....
    iElement[0].appendChild(el)
    

提交回复
热议问题