These are the steps I followed to successfully install PrimeNG:
npm install primeng --save npm install primeui --save
To update Index.html: (I had to copy directories primeng and primeui from node_modules to the assets folder in order to resolve the 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>
Outcome: nothing is displaying on the page.
Is there something I overlooked?
Edit1:
- I now realize it’s important to mention that I installed the project using angular-cli
- If I include
in test.component.html, I encounter<p-calendar [(ngModel)]="dateValue"></p-calendar>
Error: Uncaught (in promise): Cannot assign to a reference or variable!
Edit2:
I attempted this in another project that does not utilize 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 receive an Error:
http://localhost:3000/primeng/primeng 404 (Not Found)
Error: Error: XHR error (404 Not Found) loading http://localhost:3000/primeng/primeng(…)