Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PrimeNG button not displaying fa icon and label in angular2

I want to display Add and Delete button in the panel header. Below code displays button with no fa-icon and no label

<p-panel>
  <p-header>
   <div>
     Registration Form
     <button type="button" pButton icon="fa-plus" style="float:right" label="Add">
     </button>
   </div>
  </p-header>
</p-panel>
like image 882
Jan69 Avatar asked Jul 27 '17 17:07

Jan69


2 Answers

Your code is working fine here.

Have you imported font-awesome to your application? If not, add this in your index.html within the <head></head> tag.

<head> 
...
  <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
 </head>

Also, you will need to import ButtonModule, PanelModule to your application.

import {ButtonModule, PanelModule} from 'primeng';

@NgModule({

  imports: [
    ...
    ButtonModule,
    PanelModule,
    ...
  ],
  ...
})
like image 80
Nehal Avatar answered Nov 12 '22 17:11

Nehal


After importing the BrowserAnimationsModule , primeng Buttons are displaying inside the panel.

import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
like image 27
Jan69 Avatar answered Nov 12 '22 17:11

Jan69