Adding ng-class and ng-click to the DOM in a Leaflet popup

586 views
Skip to first unread message

Ashley

unread,
Jul 18, 2013, 11:45:34 PM7/18/13
to ang...@googlegroups.com
I'm using Angular.JS and Leaflet.JS for a map in my location that has map markers with popups binded to them. I need to use a span with an icon that you can click to call a function and with ng-class to change the class so I tried to add that to the DOM within the popup but it's not working. Unfortunately my app is big and not open source so I can't share the whole code but I put down the relevant code here: Plunker.

With that code, in the popup the div_popup ng-class/click just shows up as "[object Object]". I tried making a directive but I couldn't figure out how to call it from the controller and I was confused how to do it without using the view at all (the map, markers and popups are generated within my controller). Would anyone know what I'm doing wrong or what's the best way to accomplish this? Any kind of help or direction to look in would be much appreciated as I've been working on this for days with no success.

Pawel Kozlowski

unread,
Jul 20, 2013, 7:44:19 AM7/20/13
to ang...@googlegroups.com
Hi!

The whole point of providing a plunker is to have life code that
people can debug. Just dumping a script fragment is no use, really...
Try to provide a running plunk that illustrates the essence of your
problem. This way people will be able to help.

Cheers,
Pawel
> --
> You received this message because you are subscribed to the Google Groups
> "AngularJS" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to angular+u...@googlegroups.com.
> To post to this group, send email to ang...@googlegroups.com.
> Visit this group at http://groups.google.com/group/angular.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>



--
AngularJS book:
http://www.packtpub.com/angularjs-web-application-development/book
Looking for bootstrap-based widget library for AngularJS?
http://angular-ui.github.com/bootstrap/

Ashley

unread,
Jul 22, 2013, 3:02:27 PM7/22/13
to ang...@googlegroups.com
Okay, I built a simple JSFiddle (that Plunker template is not working) that demonstrates something similar to what I'm trying to do. It's here: http://jsfiddle.net/HB7LU/43/. In this case, the popup isn't showing up and when I click it, I get the error: TypeError: Value does not implement interface Node. When I remove the compile, I get the popup but nothing happens on clicking it. Any ideas on how I can get this to work?
Reply all
Reply to author
Forward
0 new messages