我有一個簡單component
這樣的:錯誤,同時還與參數的構造函數組件
@Component({
selector: 'error-handler',
templateUrl: './error-handler.component.html',
styleUrls: ['./error-handler.component.css']
})
export class ErrorHandlerComponent {
constructor(public error?: any) { }
}
,當我去到瀏覽器我得到一個錯誤:
Uncaught Error: Can't resolve all parameters for ErrorHandlerComponent: (?).
我必須註冊在我的新component
模塊,所以我不知道爲什麼這個錯誤發生。我不會從任何地方調用構造函數。
刪除'公共誤差不工作? :任何'從你的構造函數,並把它作爲一個變量放在類中。 – Faisal
@Faisal沒有幫助 – Aryjadna
那麼我們需要更多關於您的代碼的信息 – Faisal