简体   繁体   English

PrimeNG列表框未显示标签

[英]PrimeNG Listbox not showing label

The "rolename" label refuses to render on the UI; “角色名称”标签拒绝在用户界面上呈现; I am using Angular 4/Prime NG 我正在使用Angular 4 / Prime NG

.html file definition .html文件定义

<p-listbox formControlName="userRole" [options]="this.userRoleItems" optionLabel="rolename" multiple="multiple" [style]='{"width":"250px"}'  checkbox="checkbox" filter="filter"
            >
          </p-listbox>

constructor of .ts file .ts文件的构造函数

 userRoleItems: UserRole[] = [{id: 2, rolename: 'test'}]; ;

userrole class definition: userrole类的定义:

  export class UserRole {
      id: number;
      rolename: string;
  }

Picture of how it is on the UI: (You see the checkbox shows but not tthe label) UI上的图片:(您看到复选框显示但标签未显示)

在此处输入图片说明

I have the same behaviour with primeng 4.1.0, the problem is related to your primeng version. 我与primeng 4.1.0具有相同的行为,问题与您的primeng版本有关。 Try to upgrade to latest 4.3.0. 尝试升级到最新的4.3.0。

See the link below for a plunkr demo. 请参阅下面的链接以获取plunkr演示。

link: demo link: 演示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM