2017-02-09 127 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 // <-- 
})