Primeng Button not showing label

2019-07-07 01:19发布

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>

2条回答
何必那么认真
2楼-- · 2019-07-07 01:37

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
   ]
   ...
查看更多
Root(大扎)
3楼-- · 2019-07-07 01:56

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.

查看更多
登录 后发表回答