[英]Primeng dropdown in form
Hey guys i am using primeng 9 dropdown and i am trying to get the value of the dropdown in form.嘿伙计们,我正在使用primeng 9下拉菜单,我正在尝试以表格形式获取下拉菜单的值。 this is the code
<form #f="ngForm"> <div class="p-col-8"> <p-dropdown id="group" [options]='groupList' optionLabel="name" formControlName="group" ngModel></p-dropdown> </div> </form> <button (click)="addPhoneNo(f)" label="Save"></button>
.这是代码
<form #f="ngForm"> <div class="p-col-8"> <p-dropdown id="group" [options]='groupList' optionLabel="name" formControlName="group" ngModel></p-dropdown> </div> </form> <button (click)="addPhoneNo(f)" label="Save"></button>
。 The addPhoneNo(data)
addPhoneNo(data)
function prints the value of the form by this code console.log(data.value)
but the problem is there is no value nor even the control (the dropdown) is not there. function 通过此代码
console.log(data.value)
打印表单的值,但问题是没有值,甚至控件(下拉菜单)也不存在。 pls help请帮忙
There must be issue with your input to the drop down, which is [options]='groupList
', I would suggest that you check what values are being passed on to the variable grouplist
and then accordingly take actions.您对下拉列表的输入一定有问题,即
[options]='groupList
',我建议您检查将哪些值传递给变量grouplist
,然后相应地采取措施。
If you refer this URL it might help you.如果您参考此 URL 它可能会对您有所帮助。 Look out for the Getting Started Section https://www.primefaces.org/primeng/showcase/#/dropdown
查看入门部分https://www.primefaces.org/primeng/showcase/#/dropdown
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.