簡體   English   中英

在創建暫存/生產構建(Angular)時使用本地參考中斷

[英]Using Local reference breaks while create a staging/production build (Angular)

以下是我在創建構建時遇到的模板代碼和錯誤,盡管它在我執行ng serve時工作正常。

<input type="text" class="form-control unit-price"  name="unit_price" [(ngModel)]="item.unit_price" #unitPrice="ngModel" required>
           <span class="small text-danger" *ngIf="!unitPrice?.valid && unitPrice?.touched ">Field is Required</span>

在此處輸入圖像描述

有什么我想念的嗎?

我是否必須在組件中聲明該屬性?

在我的 UnderStanding項目對象內沒有unitPrice字段,請驗證您在 [(ngModel)] 中提到的項目對象。

另一方面,在您的代碼中將此: #unitPrice="ngModel"轉換為: #unit_price="ngModel"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM