我每次調用這個函數我收到一個錯誤,告訴我說:「類型錯誤:co.newMethod2是不是一個函數」爲什麼在調用有效函數時會出現類型錯誤? |角2
我不明白爲什麼我的方法是我喜歡的類型的腳本文件有效。這裏是我的代碼
創建-sharecase.component.html
<div>
<p> Template Description </p>
<textarea [ngModel]="textValue" (ngModelChange)="newMethod2()">
</textarea>
</div>
創建-sharecase.component.ts
newMethod2(){
console.log("Text Area Method");
if (this.textValue != '') {
console.log("Text Value" + this.textValue);
}}`
對我來說,這應該是有效的代碼,並要執行!所有hep將不勝感激!
你可以添加你的@Component數據? –
請添加一個[最小,完整和可驗證示例](https://stackoverflow.com/help/mcve)。您可以將[Plunkr](https://plnkr.co/)用於Angular。 –
組件裝飾已經到位的類型的腳本文件 –