angularjs - angular leaflet custom markers (using angular directives) -


i'm trying create "leaflet marker" using angular directive. design purposes, separate presentation , model different persons can work on different parts of application. issue, more likely, more "scope" problem "leaflet" problem. i'm trying pass object used in angular directive, while i'm adding markers on "$scope", in controller. directive, "" in app, tag in "message" property on each marker object presented in map. has attribute "estacao" in portuguese same "station".

so, code here:

        angular.foreach($scope.estacoes, function(estacao) {             $scope.markers.push({                 lat: estacao.latitude,                  lng: estacao.longitude,                  message: "<popup estacao='estacoes[" + + "]'></popup>"             });             i++;         });  http://plnkr.co/edit/evaqpqgzuz39y7mnqbo7?p=preview 

the problem seams "estacao" null when directive processed.

can me figure out happening?

the 'auto' compile of popup message (from leaflet directive) uses root scope. need assign response estacoes root scope:

promiseestacoes.then(function(estacoes) {    $rootscope.estacoes = estacoes.estacoes;    ... } 

http://plnkr.co/edit/okqcth2znredo2rgwbv8?p=preview


Comments

Popular posts from this blog

javascript - IndexedDB error: Uncaught DataCloneError: Failed to execute 'put' on 'IDBObjectStore': An object could not be cloned -

java - Unable to make sub reports with Jasper -

Integrity error when loading fixtures for Selenium testing in Django -