читаю Angular.В нем говорится, что если вы хотите связать свойство, оно должно быть заключено в [].Итак, вот что я сделал, но я получаю ошибку.Любая идея, что я делаю не так?
Мне нужно, чтобы значение data-lightbox было тем, что я устанавливаю / отправляю из другого компонента (родительского компонента)
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",