将指令与传单标记一起使用

Using Directives with Leaflet markers

我正在使用 AngularJS 和 Leaflet 进行一些实验(我是这两个方面的新手)。我看到我可以指定一些 HTML 作为 markers.bindPopup(...); 参数。有没有人尝试将 AngularJS 指令显示为参数?我尝试过这种方式但没有成功(不足为奇)bindPopup(<myDummyDirective></myDummyDirective>)。我想将我的指令显示为标记的弹出窗口,有没有办法做到这一点?

使用$compile:

Compiles an HTML string or DOM into a template and produces a template function, which can then be used to link scope and the template together.

$compile('<myDummyDirective></myDummyDirective>')(scope);

见参考:https://docs.angularjs.org/api/ng/service/$compile