bbfdfc996cf17c5913494bb05f66818da8a785edd7d053e5a6d0aca3708af9e2.json 5.0 KB

1
  1. {"ast":null,"code":"import { __decorate } from \"tslib\";\nimport __NG_CLI_RESOURCE__0 from \"./map.component.html?ngResource\";\nimport __NG_CLI_RESOURCE__1 from \"./map.component.scss?ngResource\";\nimport { Component } from '@angular/core';\nimport * as L from 'leaflet';\nimport { RestaurantsService } from 'src/app/services/restaurants.service';\nlet MapComponent = 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.ctorParameters = () => [{\n type: RestaurantsService\n }];\n};\nMapComponent = __decorate([Component({\n selector: 'app-map',\n template: __NG_CLI_RESOURCE__0,\n styles: [__NG_CLI_RESOURCE__1]\n})], MapComponent);\nexport { MapComponent };","map":{"version":3,"names":["Component","L","RestaurantsService","MapComponent","constructor","restaurantsService","ngOnInit","macarte","map","setView","tileLayer","attribution","addTo","myIcon","icon","iconUrl","getRestaurants","subscribe","data","console","log","forEach","res","marker","latitude","longitude","bindPopup","name","adress","maxWidth","minWidth","_","__decorate","selector","template","__NG_CLI_RESOURCE__0"],"sources":["C:\\FatboarProject\\angular-client\\src\\app\\components\\shared\\contact\\map\\map.component.ts"],"sourcesContent":["import { Restaurant } from './../../../../models/restaurant';\r\nimport { Component, OnInit } from '@angular/core';\r\nimport { HttpClient } from '@angular/common/http';\r\nimport * as L from 'leaflet';\r\nimport { RestaurantsService } from 'src/app/services/restaurants.service';\r\n\r\n\r\n@Component({\r\n selector: 'app-map',\r\n templateUrl: './map.component.html',\r\n styleUrls: ['./map.component.scss']\r\n})\r\nexport class MapComponent implements OnInit {\r\n constructor(private restaurantsService: RestaurantsService) {}\r\n \r\n // Fonction d'initialisation du composant.\r\n ngOnInit() {\r\n // Déclaration de la carte avec les coordonnées du centre et le niveau de zoom.\r\n const macarte = L.map('frugalmap').setView([48.85513, 2.353429], 9);\r\n \r\n L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {\r\n attribution: 'FatBoar',\r\n }).addTo(macarte);\r\n \r\n const myIcon = L.icon({\r\n // iconUrl: 'https://cdnjs.cloudflare.com/ajax/libs/leaflet/1.2.0/images/marker-icon.png'\r\n iconUrl: \"../assets/img/marker/markericon.png\"\r\n \r\n });\r\n \r\n \r\n this.restaurantsService.getRestaurants().subscribe((data: any) => {\r\n console.log('test resto', data)\r\n data.forEach( (res : Restaurant ) => {\r\n var marker = L.marker([res.latitude, res.longitude], {icon: myIcon}).addTo(macarte);\r\n \r\n\r\n marker.bindPopup(`<h5 style=\"text-align: center\"><b>${res.name}</b></h5> <b> adresse : </b>${res.adress}`,\r\n { maxWidth: 130 , minWidth:120}\r\n );\r\n });\r\n });\r\n \r\n }\r\n }\r\n"],"mappings":";;;AACA,SAASA,SAAS,QAAgB,eAAe;AAEjD,OAAO,KAAKC,CAAC,MAAM,SAAS;AAC5B,SAASC,kBAAkB,QAAQ,sCAAsC;AAQlE,IAAMC,YAAY,GAAlB,MAAMA,YAAY;EACvBC,YAAoBC,kBAAsC;IAAtC,KAAAA,kBAAkB,GAAlBA,kBAAkB;EAAuB;EAE7D;EACAC,QA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