This is the component template:
<div style="max-width: 100rem;
margin-top: 5rem;
min-height: 20rem;
overflow: hidden;">
<img style="width: 100%;
height: auto;
margin: -20% 0 -20% 0;"
[src]="src">
</div>
And the component class:
import { Input, Component, OnInit } from '@angular/core';
@Component({
selector: 'image',
templateUrl: './image.component.html',
styleUrls: ['./image.component.scss']
})
export class ImageComponent implements OnInit {
@Input() src;
@Input() crop = "-20%"
constructor() { }
ngOnInit() {
}
}
I thought it would be possible to add the crop
input value into the template like this:
margin: {{crop}} 0 {{crop}} 0;"
However this does not work. Thoughts?