1. 程式人生 > >Angular prod打包編譯異常

Angular prod打包編譯異常

編譯異常

Property 'small' does not exist on type 'IsProjectComponent'.
  • 問題描述:small物件在ts中不存在,
  • 解決方案:如果small作為物件使用,在ts中新增small作為屬性,如果是字串那麼新增單引號"'small'"
Property 'ifDisplay' is privateand only accessible within class 'IsRadioGruopWidgetComponent'. 
  • 問題描述:ifDisplay 是私有的不只能在ts中訪問,html中不能訪問
  • 解決方案:ts中ifDisplay中的private宣告去掉.
Expected 0 arguments, but got 1.
  • 問題描述:ts中定義的方法沒有引數,呼叫的時候卻傳了引數
  • 解決方案:刪除引數.
Expected 1 arguments, but got 0.
  • 問題描述:ts中定義的方法只有引數,呼叫的時候卻未傳引數
  • 解決方案:新增引數.

 

開發規範

  1. 在html屬性繫結的欄位,一定要ts中定義。並且定義的欄位的作用域是預設的public。別定義成private等型別。
  2. 在html中觸發事件呼叫的方法,一定要在ts中定義。並且定義方法有幾個引數,在html中呼叫的時候就傳幾個引數。