| 1 |
- {"ast":null,"code":"import * as L from 'leaflet';\nimport * as i0 from \"@angular/core\";\nimport * as i1 from \"src/app/services/restaurants.service\";\nexport let MapComponent = /*#__PURE__*/(() => {\n class MapComponent {\n constructor(restaurantsService) {\n this.restaurantsService = restaurantsService;\n }\n // Fonction d'initialisation du composant.\n ngOnInit() {\n // Déclaration de la carte avec les coordonnées du centre et le niveau de zoom.\n const macarte = L.map('frugalmap').setView([48.85513, 2.353429], 9);\n L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {\n attribution: 'FatBoar'\n }).addTo(macarte);\n const myIcon = L.icon({\n // iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/images/marker-icon.png'\n iconUrl: \"../assets/img/marker/markericon.png\"\n });\n this.restaurantsService.getRestaurants().subscribe(data => {\n console.log('test resto', data);\n data.forEach(res => {\n var marker = L.marker([res.latitude, res.longitude], {\n icon: myIcon\n }).addTo(macarte);\n marker.bindPopup(`<h5 style=\"text-align: center\"><b>${res.name}</b></h5> <b> adresse : </b>${res.adress}`, {\n maxWidth: 130,\n minWidth: 120\n });\n });\n });\n }\n static #_ = this.ɵfac = function MapComponent_Factory(t) {\n return new (t || MapComponent)(i0.ɵɵdirectiveInject(i1.RestaurantsService));\n };\n static #_2 = this.ɵcmp = /*@__PURE__*/i0.ɵɵdefineComponent({\n type: MapComponent,\n selectors: [[\"app-map\"]],\n decls: 1,\n vars: 0,\n consts: [[\"id\", \"frugalmap\"]],\n template: function MapComponent_Template(rf, ctx) {\n if (rf & 1) {\n i0.ɵɵelement(0, \"div\", 0);\n }\n },\n styles: [\"#frugalmap[_ngcontent-%COMP%]{height:300px;width:100%;border-radius:1em}\"]\n });\n }\n return MapComponent;\n})();","map":null,"metadata":{},"sourceType":"module","externalDependencies":[]}
|