I read Angular. It says if you want to bind a property it should be wrapped with []. So here what I did, But I am getting error. Any idea what am I doing wrong?
My requirement is to have the value of data-lightbox is what I am setting/sending from another component(parent component)
image-display.component.ts
@Component({
selector: 'app-image-display',
templateUrl: './image-display.component.html',
styleUrls: ['./image.component.css']
})
export class ImageDisplayComponent implements OnInit {
@ViewChild('inspImage') image: ElementRef
@Input() inspection: LineSideInspection
inpsectionId: number;
santizer: DomSanitizer
constructor(private imageService: ImageDisplayService, private sanitizer: DomSanitizer) {}
ngOnInit() {
this.getMyImage('/getimage/' + this.inspection.id );
this.inpsectionId = this.inspection.id;
}
}
image-display.component.html
<a [href]="sanitize(inspImage.src)" [data-lightbox]="inspectionId" data-title="inspect.inspectionDescription">
<img #inspImage width="110px" height="95px">
</a>
package.json:
"lightbox2": "^2.10.0",