Search code examples
angularangular-materialfirebase-hosting

Unable build the angular 2 project using ng build --prod


I have created a angular 2 project using angular material. I am trying to host my project using firebase deployment process.

My application is successfully running on my server.But when I am trying to build my application its giving me the following error as shown below in the image.


enter image description here

please help me to resolve this


Solution

  • Solution: for let- is only support for ng-template error.

    You have use let-variablename some where in you html side. The error says you can't use it anywhere instead of ng-template.

    Solution 1.

    Use ng-template wherever you are using NgForOf

    like below this,

    if you are using this kind of below code.

     <div ngFor let-variableName [ngForOf]="ListOfData" let-index=index ></div>
    

    Then it should be change it into ng-template

     <ng-template ngFor let-variableName [ngForOf]="ListOfData" let-index=index ></ng-template>
    

    Solution 2

    Use this below for loop

    *ngFor="let variableName of ListOfData; let index = index"
    

    instead of which is you are using kind

    ngFor let-variableName [ngForOf]="ListOfData" let-i=index 
    

    I hope this above both solutions are helps you.

    Edit:

    Run with this below command instead of yours

     ng build --prod --aot=false --build-optimizer=false