I have a situation where I need to create and insert components dynamically.
The exact situation is adding markers to a map within Leaflet.
The syntax to do so looks like this:
L.marker(latLng, {title: someTitle, icon: icon}).addTo(this.map).bindPopup(popupContent);
In this case popupContent
is either a string of HTML or an HTMLElement
object.
I was wondering what the best way to do this with Angular2 would be.
EDIT: A guess a better question is, given that leaflet will be handling the popup anyway, would it be an anti-pattern of sorts if I were to manually compose the HTML (using, for example, a mustache or lodash template) rather than using an Angular component.