Primeng Button not showing label

爷,独闯天下 提交于 2020-01-04 04:06:16

问题


I have primeng button in my angular4 application.

label of the button is not displaying.Button is displaying very small without label.

<div id="main">
  <form #newJobCleanUpForm="exForm" (ngSubmit)="onSubmit(exampleForm)">

    <label class="stylelabel" for="jobNumber"><span>Job Number</span>
      <input  type="text" pInputText  class="styletext" id="jobNumber" required  [(ngModel)]="jobNumber" name="jobNumber">
      <button pButton type="button"  label="Click"></button></label>
</form>
</div>

回答1:


This issue is caused by a missing import of PrimeNG's ButtonModule.

Please add this import to the same module, your component is defined in.

import {ButtonModule} from 'primeng/primeng';

...

@NgModule({
   imports: [
      ...
      ButtonModule
   ]
   ...



回答2:


In the form i have a primeng text area and forgot to add name attribute to the text area. Primeng buttons were not displaying because of this. I corrected this mistake and everything works fine.



来源:https://stackoverflow.com/questions/45305915/primeng-button-not-showing-label

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!