quentinlampin / ngx-openlayers

Angular2+ components for Openlayers 4.x
Mozilla Public License 2.0
137 stars 98 forks source link

<aol-overlay> can't getPosition #263

Open cesarbenjamindotnet opened 3 years ago

cesarbenjamindotnet commented 3 years ago

Hello, i have a lot of days dealing with this:

i have a few weeks working with this library, all seems going well, but now i have to show some info i got from wms server. i'm trying to use with this code:

`<aol-overlay *ngIf="WMSInfo.mostrar" #popupOverlay [autoPan]="true"> <aol-coordinate [x]="clickCoord4326[0]" [y]="clickCoord4326[1]" [srid]="'EPSG:4326'"

                <aol-content>
                    <div #popupInfo class="ol-popup">
                        <a (click)="quitarPopupInfo()" #popupCloser class="ol-popup-closer"></a>
                        <div id="popup-info-content">
                            <p [innerText]="clickCoord4326"></p>
                            <div *ngFor="let info of WMSInfo.contenido">
                                <div>{{ info.nombre }} {{ info }}</div>
                                <hr>
                            </div>
                        </div>
                    </div>
                </aol-content>
            </aol-overlay>`

but when i test the app, i got an error in console about of this.host.instance is undefined

ERROR TypeError: this.host.instance is undefined ngOnChanges coordinate.component.js:45 Angular 6 MapaViewComponent_aol_layer_tile_42_aol_source_tilewms_1_aol_overlay_2_Template mapa-view.component.html:222 Angular 42 RxJS 5 Angular 17 RxJS 22

seems something is not coming well to coordinate.component.js:45 but i cant find why or what :(

can you check this please?

i have angular 10, btw

Shaurya-Yay commented 3 years ago

I am facing the same problem after upgrading angular version from 9 to 10 and then 11. Cannot read property 'setPosition' of undefined at CoordinateComponent.ngOnChanges (coordinate.component.js:49)

peterrauch88 commented 2 years ago

Is there a solution for this problem? After upgrading the angular version, I got the same message.

peterrauch88 commented 2 years ago

adding peerDependencies to package.json solved my problem "peerDependencies": { "@angular/common": ">=6.0.0 <=10.x.x", "@angular/core": ">=6.0.0 <=10.x.x", "ol": "^6.0.0" }