I'm trying to give the property style.marginTop.px to my html by loading the value of an angular variable. Something like this:
Template:
<div class="map-container">
<div class="map">
<div class="marcador" [style.marginTop.px]="top" [style.marginLeft.px]="left"><b>X</b></div>
</div>
Component:
private moveTheMark(place: any): void {
switch(place) {
case '0':
this.top = '163px';
this.left = '420px';
break;
case '1':
this.top = '165px';
this.left = '467px';
break;
}
}
The moveTheMark function is called in the ngOnChanges and modifies the value of top and left depending on the place parameter. However, I can not make it work. Any ideas?