AW-6046 Angular 17
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
Some checks failed
FarmMaps.Develop/FarmMapsLib/pipeline/head There was a failure building this commit
This commit is contained in:
28
projects/ng-openlayers/src/lib/sources/source.component.ts
Normal file
28
projects/ng-openlayers/src/lib/sources/source.component.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { Input, OnDestroy, Directive } from '@angular/core';
|
||||
import Source from 'ol/source/Source';
|
||||
|
||||
import { LayerComponent } from '../layers/layer.component';
|
||||
|
||||
@Directive()
|
||||
// eslint-disable-next-line @angular-eslint/directive-class-suffix
|
||||
export abstract class SourceComponent implements OnDestroy {
|
||||
@Input()
|
||||
attributions: any;
|
||||
|
||||
public instance: Source;
|
||||
public componentType = 'source';
|
||||
|
||||
protected constructor(protected host: LayerComponent) {}
|
||||
|
||||
ngOnDestroy() {
|
||||
if (this.host && this.host.instance) {
|
||||
this.host.instance.setSource(null);
|
||||
}
|
||||
}
|
||||
|
||||
protected register(s: Source) {
|
||||
if (this.host) {
|
||||
this.host.instance.setSource(s);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user