I am accessing an API where in json object I am getting svg image string after sanitizing the image string
this.apiService.receiveImageAsNonJSON("http://localhost:8080/icreate/getViewImagesBySubCategory", subCatName).subscribe(viewImageDataSet => {
this.masterImageList = viewImageDataSet;
var masterImageListLength = this.masterImageList.length;
// Calculate number columns , number of rows is fixed at 7
let colCount = Math.ceil(masterImageListLength / 7);
for (var index = 0; index < masterImageListLength; index++) {
// Sanitize image string
this.masterImageList[index] = this.sanitizer.bypassSecurityTrustHtml(this.masterImageList[index] as string);
});
Now i am displaying the image in html by using [outerHTML] property. I am getting the actual size of the svg, But I want my custom size. How to fix it out. anyone please give light. Thank you in advance --Midde
Here I have attached the screen shot, and mark the height and width in blue circle which I want to customize. Output Screen Shot
it's quit ugly but you can try the NgStyle directive ( https://angular.io/api/common/NgStyle )
Can you try the following code:
Component .ts
sizeOuter():string{
var resizeComment:number;
resizeComment=window.innerWidth-45/10;
return resizeComment + 'px';
}
heightOuter():string{
var resizeComment:number;
resizeComment=window.innerHeight-45/10;
return resizeComment + 'px';
}
html:
<div [ngStyle]="{'width': sizeOuter(),'height':heightOuter()}" [outerHTML]="image.thumbNailImage">i j</div> </div>
with best regards,
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.