Here are the steps I did to install PrimeNG:
npm install primeng --save npm install primeui --save
Update Index.html: (I had to copy directories primeng and primeui from node_modules to the assets folder to get rid of 404 file not found error)
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootswatch/3.3.6/flatly/bootstrap.min.css" rel="stylesheet"> <link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.6.3/css/font-awesome.min.css" rel="stylesheet"> <link rel="stylesheet" href="assets/styles.css"> <link rel="stylesheet" href="assets/primeui/themes/omega/theme.css"> <link rel="stylesheet" href="assets/primeui/primeui-ng-all.min.css">`
Update test.component.ts:
import {Calendar} from '../../assets/primeng/primeng'; .... export class TestComponent { dateValue:string; }
Update test.component.html:
<p-calendar formControlName="date"></p-calendar>
Result: nothing gets shown on page.
Am I missing something?
Edit1:
- I now think it's important to say I installed the project using angular-cli
- If I add
<p-calendar [(ngModel)]="dateValue"></p-calendar>
to test.component.html , I getError: Uncaught (in promise): Cannot assign to a reference or variable!
Edit2:
I just tried it in another project that is not using angular-cli:
<link rel="stylesheet" href="node_modules/primeui/themes/omega/theme.css" />
<link rel="stylesheet" href="node_modules/primeui/primeui-ng-all.min.css" />
....
import {Calendar} from 'primeng/primeng';
....
<p-calendar formControlName="date"></p-calendar>
as soon as I add directives:[Calendar]
I get Error:
http://localhost:3000/primeng/primeng 404 (Not Found)
Error: Error: XHR error (404 Not Found) loading http://localhost:3000/primeng/primeng(…)
import {Calendar} from 'primeng/primeng';
And have you addedCalendar
to thedirectives
array of the@Component{}
declaration? – Poul KruijtSystemJS
for instance, you have to add primeng to the mapping'primeng': 'node_modules/primeng'
as well as to the packages'primeng': { defaultExtension: 'js' }
– Poul Kruijtsystem.config.js
, maybe u can add a complete answer now. – Cristian Muscalu