@ ng- bootstrap - NgbModule | setAttribute не работает (Установите Angular Директивы с Javascript) - PullRequest
0 голосов
/ 19 марта 2020

У меня есть этот простой div

<div style="width:100px; background-color:black; height:100px;" id="workSetAttribute">

   Come on setAttribute work

</div>

и ngOnInit () Я делаю:

var workSetAttribute = document.getElementById("workSetAttribute")

workSetAttribute.setAttributeNS(null, "triggers", "mouseenter:mouseleave");
workSetAttribute.setAttributeNS(null, "popoverTitle", "title");
workSetAttribute.setAttributeNS(null, "ngbPopover", "descr");
workSetAttribute.setAttributeNS(null, "ng-reflect-ngb-popover", "descr");
workSetAttribute.setAttributeNS(null, "ng-reflect-popover-title", "title");
workSetAttribute.setAttributeNS(null, "ng-reflect-triggers", "mouseenter:mouseleave");

, когда я осмотрите элемент, который html прекрасно работает:

<div style="width:100px; background-color:black; height:100px;" id="workSetAttribute"
      triggers="mouseenter:mouseleave" popoverTitle="title" ngbPopover="descr" 
ng-reflect-triggers="mouseenter:mouseleave" ng-reflect-popover-title="title" ng-reflect-ngb-popover="descr">

   Come on setAttribute work

</div>

но поповер не будет работать ..

Конечно, если я просто добавлю класс или что-то еще хорошо ..

Еще одна мысль, которую я должен упомянуть, это то, что я не могу пометить свой div (например, div #comeOn) и использовать его с ViewChild, потому что div создаются с помощью стороннего librady (fullcalendar.io) ) и я не могу контролировать тег (если нет способа, о котором я не знаю)

**

Я думаю, это может быть более общий вопрос, например :

Как установитьОтправить директиву angular

**

...