Skip to content

Commit

Permalink
feat(controls): added input for customAttributions to attribution-con…
Browse files Browse the repository at this point in the history
…trol directive
  • Loading branch information
FreakyBytes authored and Wykks committed Jul 3, 2019
1 parent 0a60463 commit c93e118
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { ControlComponent } from './control.component';
export class AttributionControlDirective implements OnInit {
/* Init inputs */
@Input() compact?: boolean;
@Input() customAttribution?: string | string[];

constructor(
private MapService: MapService,
Expand All @@ -20,10 +21,13 @@ export class AttributionControlDirective implements OnInit {
if (this.ControlComponent.control) {
throw new Error('Another control is already set for this control');
}
const options: { compact?: boolean } = {};
const options: { compact?: boolean, customAttribution?: string | string[] } = {};
if (this.compact !== undefined) {
options.compact = this.compact;
}
if (this.customAttribution !== undefined) {
options.customAttribution = this.customAttribution;
}
this.ControlComponent.control = new AttributionControl(options);
this.MapService.addControl(this.ControlComponent.control, this.ControlComponent.position);
});
Expand Down

0 comments on commit c93e118

Please sign in to comment.