2017-02-09 57 views
2

用我的角2的應用程序,傳單加載罰款之外相同的配置,但是這是在角2會發生什麼:角2單張瓷磚巨大差距

如果我移動地圖,不同小塊負載,但同樣的問題依然存在。

HTML:

<div class="leaflet-maps" id="map"></div> 

組件:

styleUrls: ['./maps.component.scss'] 

我在哪裏粘貼傳單的內容:

let el = this._elementRef.nativeElement.querySelector('.leaflet-maps'); 

    let map = L.map("map", { 
     zoomControl: false, 
     center: L.latLng(37.8, -96), 
     zoom: 5, 
     minZoom: 4, 
     maxZoom: 19 
    }); 

    L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', { 
     attribution: '&copy; <a href="http://osm.org/copyright">OpenStreetMap</a> contributors' 
    }).addTo(map); 

我已經通過加載單張css文件css

/* required styles */ 

.leaflet-pane, 
.leaflet-tile, 
.leaflet-marker-icon, 
.leaflet-marker-shadow, 
.leaflet-tile-container, 

.... 

enter image description here

回答

2

這個固定我的問題:

import { Component, ViewEncapsulation} from '@angular/core'; 

@Component({ 
    selector: 'maps', 
    templateUrl: 'maps.component.html', 
    styleUrls: ['./maps.component.scss'], 
    encapsulation: ViewEncapsulation.None // <-- 
})