Ngx-admin: How to Integrate primeng ?

Created on 6 Jun 2016  路  7Comments  路  Source: akveo/ngx-admin

  • I'm submitting a ...
    [ ] bug report
    [x ] feature request
    [ ] question about the decisions made in the repository

Can you please explain how to import and use "primeNG" ui components?

I created a new page and I tried to place the primeNG panel, but this is not displayed correctly.
(sorry my bad english)

import {Component} from '@angular/core';
import { Panel} from 'primeng/primeng';

@Component({
selector: 'new',
pipes: [],
providers: [],
directives: [Panel],
styles: [],
template: <p-panel header="Title"> Content </p-panel>
})
export class New {

constructor() {
}
}
Thanks.

question

Most helpful comment

Would be nice to have an update on this since a lot has changed. What is the proper method to import some primeNg components into ng2-admin?

All 7 comments

Hi @erlopezh, are there any errors in browser console?

Hi @nnixaa , there are no errors in the browser console

@erlopezh okay, it's hard to debug the issue this way, could you provide a plunker or something? Have you imported the styles as per http://www.primefaces.org/primeng/#/setup documentation?

Hi @nnixaa , I had imported styles according primeng documentation, but can not be located from the folder "node_modules/primeui"

As workaround, i had copied

node_modules/primeui/themes
node_modules/primeui/primeui-ng-all.min.css
node_modules/primeui/primeui-ng-all.min.js

to the "assets" folder. Webpack copies the contents of "assets" folder to "dist" folder

聽聽 new CopyWebpackPlugin ([{
聽聽聽聽聽聽 from: 'src/assets'
聽聽聽聽聽聽 to: 'assets'
聽聽聽聽 }]),

In the index.html, i had changed "node_modules" to "assets"

<link rel="stylesheet" type="text/css" href="assets/primeui/themes/omega/theme.css" /> <link rel="stylesheet" type="text/css" href="assets/icon/css/font-awesome.min.css" /> <link rel="stylesheet" type="text/css" href="assets/primeui/primeui-ng-all.min.css" />

then the components are displayed correctly

is this workaround the right way ?

@erlopezh yes, there is a way to include styles correctly, for example, take a look at this 'loader' for fullCalendar jquery plugin https://github.com/akveo/ng2-admin/blob/master/src/app/theme/components/baFullCalendar/baFullCalendar.loader.ts

then this file is just imported into the component where it used.
I guess you can do this the same way, create a loader, require styles and js files in it and then import it into your component.

@erlopezh hope this helped, I'm closing the issue now, let me know if you need any assistance.

Would be nice to have an update on this since a lot has changed. What is the proper method to import some primeNg components into ng2-admin?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yanyim picture yanyim  路  3Comments

burtonator picture burtonator  路  3Comments

PatrickHuetter picture PatrickHuetter  路  3Comments

nsankaranarayanan picture nsankaranarayanan  路  3Comments

argnist picture argnist  路  4Comments