Advertisement
Guest User

Untitled

a guest
Jan 16th, 2017
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.70 KB | None | 0 0
  1. vm.recarregarRota = function (){
  2. $window.location.reload();
  3. }
  4.  
  5. <div class="col-md-12 box_map" style="padding: 20px 30px 20px 30px;">
  6. <div id="recent_activity" class="box_whiteframe_map">
  7. <leaflet defaults="vm.defaults" lf-center="vm.center" ng-init="vm.buscaEnderecoClientesEmpresas()" markers="vm.markers" width="100%" height="480px"></leaflet>
  8. </div>
  9. </div>
  10.  
  11. vm.markers = new Array(); //CRIA MARKERS A SEREM UTILIZADOS NO MAP
  12.  
  13. vm.buscaEnderecoClientesEmpresas = function() {
  14. vm.items.then(function(items) { // ler array de retorno
  15. relatoriosService.carregarEnderecoClientesEmpresas(dados).then(function(response) {
  16. if (response.data != 'null') {
  17. vm.enderecoClientesEmpresas = response.data; //ARRAY QUE VEM DO BD
  18. angular.forEach(vm.enderecoClientesEmpresas, function(value, key) { //FOREACH UTILIZADO PARA PERCORRER ARRAY
  19.  
  20. vm.markers.push({
  21. group: value.estado, //DADOS PROVENIENTES DO BD.
  22. lat: value.latitude, //DADOS PROVENIENTES DO BD.
  23. lng: value.longitude, //DADOS PROVENIENTES DO BD.
  24. message: "teste",
  25. icon: {
  26. type: 'awesomeMarker',
  27. prefix: 'fa',
  28. icon: icon,
  29. markerColor: color
  30. },
  31. label: {
  32. options: {
  33. noHide: true
  34. }
  35. }
  36. });
  37. });
  38. } else {
  39. vm.enderecoClientesEmpresas = '';
  40. }
  41.  
  42. }, function(error) {
  43. console.log('Erro findSemEmail: ', error);
  44. });
  45. });
  46. }
  47.  
  48.  
  49. angular.extend(vm, { // EXTENDE AS PROPRIEDADES DO MAP (MARCADORES, LOCALIZAÇÃO INCIAL..)
  50. center: { // LOCALIZAÇÃO INICIAL .
  51. lat: -27.952419,
  52. lng: -52.211667,
  53. zoom: 6
  54. },
  55. defaults: { //LAYER É O TIPO DE MAPA A SER UTILIZADO
  56. tileLayer: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png",
  57. zoomControlPosition: 'topright',
  58. tileLayerOptions: {
  59. opacity: 0.9,
  60. detectRetina: true,
  61. reuseTiles: true,
  62. attribution: '&copy; <a href="http://www.openstreetmap.org/copyright">OpenStreetMap</a> | &copy <a href="http://www.openstreetmap.org/copyright">Funil PRÓ</a>',
  63. },
  64. }
  65. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement