我不知道是否可行,至少我没有在网上找到任何东西。我想将指令附加到div
包生成的leaflet
上。
我的组件
<div id="leaflet-map"
leaflet>
</div>
它生成以下元素:
<div id="leaflet-map" leaflet="" class="leaflet-container leaflet-touch leaflet-fade-anim leaflet-touch-zoom leaflet-grab leaflet-touch-drag" ng-reflect-options="[object Object]" style="position: relative;">
<div class="leaflet-pane leaflet-map-pane" style="transform: translate3d(-83px, 0px, 0px);">
</div>
</div>
这时,我有了本文Listening to DOM Changes Using MutationObserver in Angular中的变更检测器指令,由于要查看该div上的更改,因此我希望将其绑定到生成的<div class="leaflet-pane leaflet-map-pane" ... </div>
上。它应该看起来像:<div class="leaflet-pane leaflet-map-pane" (domChange)="onDomChange()" ... </div>