I'm trying to figure out the best way to pass a selected value from a select input to a directive that will draw it on a leaflet map. My goal is for the select box to reset immediately after selection, while ensuring that the directive receives the shape and draws it without any delay.
One idea I had was to use a service as an intermediary. When a shape is selected, the select controller would update the service by setting the drawThisShape
variable. This variable would be watched by the directive, prompting it to draw the shape when it changes. However, this approach seems overly complex and leaves the service with outdated information.
I can't help but think there's a simpler solution to this problem. Any suggestions on a more efficient way to achieve this?
For clarity, the controller controls the select input, while the directive responsible for drawing the shape is associated with a leaflet map instance; these two components are not directly linked.