Closed kattsushi closed 7 years ago
Something like this is maybe an approach for you (Based on this example in src/app/map/map.component.ts
):
import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { OSM_TILE_LAYER_URL, MapComponent as YagaMapComponent } from '@yaga/leaflet-ng2'
@Component({
selector: 'app-map',
templateUrl: './map.component.html',
styleUrls: ['./map.component.css']
})
export class MapComponent implements OnInit, AfterViewInit {
@ViewChild(YagaMapComponent) public map: YagaMapComponent;
constructor() { }
public tileLayerUrl: string = OSM_TILE_LAYER_URL;
ngOnInit() {
}
ngAfterViewInit() {
((this.map as any)._container as HTMLElement).style.height = '300px';
}
}
Thanks a lot !! it was a lot help!
to work perfectly adding this.map.invalidateSize (); Like that because it does not change the size until window update it
import { Component, OnInit, ViewChild, AfterViewInit } from '@angular/core';
import { OSM_TILE_LAYER_URL, MapComponent as YagaMapComponent } from '@yaga/leaflet-ng2'
@Component({
selector: 'app-map',
templateUrl: './map.component.html',
styleUrls: ['./map.component.css']
})
export class MapComponent implements OnInit, AfterViewInit {
@ViewChild(YagaMapComponent) public map: YagaMapComponent;
constructor() { }
public tileLayerUrl: string = OSM_TILE_LAYER_URL;
ngOnInit() {
}
ngAfterViewInit() {
((this.map as any)._container as HTMLElement).style.height = '300px';
this.map.invalidateSize(); // <<
}
}
Cheers!
in my leaflet.css we can set this
but how i can modified this dinamicly ? y try with
in this example in jQuery i wanna the same behavior
http://jsfiddle.net/fPEaV/
and ElementRef / Rendered too by Angular, Can you help me to figure out or show me the better way to manage this ? Thanks in advance! Great Job in this component is awesome 🗡