Angular 6 - Rendering problems if BrowserAnimationsModule imported (Openlayers)

前端 未结 2 547
醉梦人生
醉梦人生 2020-12-21 22:23

I basically have a App which renders a small map. On this page is also a \"toggle\" button which hides the small map with a *ngIf in the parent component and displays the ma

2条回答
  •  猫巷女王i
    2020-12-21 22:46

    Here is a solution,

    Component template

    Component class implements OnInit and has the next property

    @ViewChild('mapElementRef') mapElementRef: ElementRef;
    

    finally initialize the map on ngOnInit method, you can use

    this.map.setTarget(this.mapElementRef.nativeElement);
    

    Hope it helps.

提交回复
热议问题