![](/img/trans.png)
[英]How I can get check box value and button value in this stuation? Can any one have suggest
[英]How can i check Template and get the value of it?
好吧,我的目的是使用復選框來選擇一個模板,然后將其添加到數據庫中,但是當我嘗試將模板代碼轉換為值時,它始終顯示未定義。
Html Code:
<input type="checkbox" id="templatepick" name="picker" value="item.templatebodyclient" (change)="displaydata($event)">
templatebody 屬性具有我們模板的 html,因此我嘗試從要在數據庫中設置的已檢查模板值中獲取它
Typescript code:
displaydata(event: { checked: any; }){
console.log("",event.checked) }
知道如何解決這個問題嗎? 或者其他想法可能有用,謝謝
您可以使用:
HTML
<input type="checkbox" id="templatepick" name="picker" [value]="item.templatebodyclient" (change)="displaydata($event)">
TS
displaydata(event: any) {
console.log(event.currentTarget.checked)
console.log(event.target.checked)
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.