diff --git a/projects/ngx-openlayers/src/lib/sources/imagewms.component.ts b/projects/ngx-openlayers/src/lib/sources/imagewms.component.ts
index 3688e986..6b8e2aa8 100644
--- a/projects/ngx-openlayers/src/lib/sources/imagewms.component.ts
+++ b/projects/ngx-openlayers/src/lib/sources/imagewms.component.ts
@@ -1,4 +1,4 @@
-import { Component, Host, Input, OnInit, forwardRef } from '@angular/core';
+import { Component, Host, Input, OnChanges, OnInit, forwardRef, SimpleChanges } from '@angular/core';
import { AttributionLike, ImageLoadFunctionType, ProjectionLike, source } from 'openlayers';
import { LayerImageComponent } from '../layers/layerimage.component';
import { SourceComponent } from './source.component';
@@ -8,7 +8,7 @@ import { SourceComponent } from './source.component';
template: ``,
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceImageWMSComponent) }],
})
-export class SourceImageWMSComponent extends SourceComponent implements OnInit {
+export class SourceImageWMSComponent extends SourceComponent implements OnChanges, OnInit {
instance: source.ImageWMS;
@Input()
@@ -42,4 +42,10 @@ export class SourceImageWMSComponent extends SourceComponent implements OnInit {
this.instance = new source.ImageWMS(this);
this.host.instance.setSource(this.instance);
}
+
+ ngOnChanges(changes: SimpleChanges) {
+ if (this.instance && changes.hasOwnProperty('params')) {
+ this.instance.updateParams(this.params);
+ }
+ }
}
diff --git a/projects/ngx-openlayers/src/lib/sources/tilewms.component.ts b/projects/ngx-openlayers/src/lib/sources/tilewms.component.ts
index 0031d2e1..11ee5680 100644
--- a/projects/ngx-openlayers/src/lib/sources/tilewms.component.ts
+++ b/projects/ngx-openlayers/src/lib/sources/tilewms.component.ts
@@ -1,4 +1,4 @@
-import { Component, Host, Input, OnInit, forwardRef } from '@angular/core';
+import { Component, Host, Input, OnChanges, OnInit, forwardRef, SimpleChanges } from '@angular/core';
import { source, TileLoadFunctionType, tilegrid } from 'openlayers';
import { LayerTileComponent } from '../layers/layertile.component';
import { SourceComponent } from './source.component';
@@ -8,7 +8,7 @@ import { SourceComponent } from './source.component';
template: ``,
providers: [{ provide: SourceComponent, useExisting: forwardRef(() => SourceTileWMSComponent) }],
})
-export class SourceTileWMSComponent extends SourceComponent implements OnInit {
+export class SourceTileWMSComponent extends SourceComponent implements OnChanges, OnInit {
instance: source.TileWMS;
@Input()
cacheSize: number;
@@ -45,4 +45,10 @@ export class SourceTileWMSComponent extends SourceComponent implements OnInit {
this.instance = new source.TileWMS(this);
this.host.instance.setSource(this.instance);
}
+
+ ngOnChanges(changes: SimpleChanges) {
+ if (this.instance && changes.hasOwnProperty('params')) {
+ this.instance.updateParams(this.params);
+ }
+ }
}