Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Binding expression cannot contain chained expression at the end of the expression ANGULAR 7

The error showing in time of npm run build

    Parser Error: Binding expression cannot contain chained expression at the end of the expression [getImageUrl(image, true);] in E:/Work/JamesJ/Pixie/pixie-image-editor/source/src/app/image-editor-ui/panels/open-sample-image-panel/open-sample-image-panel.component.html@34:9 ("

<div class="samples" *ngIf="sampleImages" >
    <img [ERROR ->][src]="getImageUrl(image, true);" *ngFor="let image of sampleImages" (click)="openSampleImage(image)"")
: Parser Error: Binding expression cannot contain chained expression at the end of the expression [getImageUrl(image, true);] in E:/Work/JamesJ/Pixie/pixie-image-editor/source/src/app/image-editor-ui/panels/open-sample-image-panel/open-sample-image-panel.component.html@34:9 ("

<div class="samples" *ngIf="sampleImages" >
    <img [src]="getImageUrl(image, true);" [ERROR ->]*ngFor="let image of sampleImages" (click)="openSampleImage(image)">
</div>")
: Parser Error: Binding expression cannot contain chained expression at the end of the expression [getImageUrl(image, true);] in E:/Work/JamesJ/Pixie/pixie-image-editor/source/src/app/image-editor-ui/panels/open-sample-image-panel/open-sample-image-panel.component.html@34:9 ("ngIf="sampleImages" >
    <img [src]="getImageUrl(image, true);" *ngFor="let image of sampleImages" [ERROR ->](click)="openSampleImage(image)">
</div>")

html code is

    <div class="samples" *ngIf="sampleImages" >
    <img [src]="getImageUrl(image, true);" *ngFor="let image of sampleImages" (click)="openSampleImage(image)">
</div>

and component code is :

public getImageUrl(image: SampleImage, useThumbnail = false) : string {
    const url = (image.thumbnail && useThumbnail) ? image.thumbnail : image.url;
    // prefix relative link with base url, if needed
    if (url.indexOf('//') === -1) {
        return this.config.getAssetUrl(url);
    } else {
        return url;
    }
}
like image 599
Abdur Rahim Avatar asked May 21 '19 14:05

Abdur Rahim


1 Answers

Remove the semicolon:

    <img [src]="getImageUrl(image, true)" ...>
like image 144
Dániel Barta Avatar answered Sep 22 '22 23:09

Dániel Barta