PrimeNg Error: Quill is not defined PrimeNg Error: Quill is not defined angular angular

PrimeNg Error: Quill is not defined


Try This: it's working for me perfectly

Versions:

Node : 7.9.0angular/cli: 1.3.0angular: 4.3.6npm: 4.2.0primeng": "^4.2.0-rc.1"

install node module quill

npm install quill --save

.angular-cli.json

"styles": [  "../node_modules/primeng/resources/themes/omega/theme.css",  "../node_modules/primeng/resources/primeng.min.css",  "../node_modules/quill/dist/quill.core.css",  "../node_modules/quill/dist/quill.snow.css"],"scripts": [  "../node_modules/quill/dist/quill.js"]

app.module.ts

import { EditorModule } from 'primeng/primeng';@NgModule({    imports: [        EditorModule    ]})

app.component.html

<p-editor [(ngModel)]="text" [style]="{'height':'320px'}"></p-editor>

app.component.ts

export class AppComponent {    text: string;}

Output


I think the problem is with the PrimeNG documentation

I was getting "doesn't exist" errors and after looking through the logs I found the path was wrong... (for Angular9 anyway).

PS: this assumes you have installed quill with npm BTW

In the angular.json script and styles section remove the "../" (as defined in the primeng docs) so it reads...

    "styles": [      "node_modules/quill/dist/quill.core.css",      "node_modules/quill/dist/quill.snow.css"    ],    "scripts": [      "node_modules/quill/dist/quill.min.js"    ]

It compiles now and fixed it for me.

Not sure if this is a Windows thing but the "../" was telling the compiler to looking in the wrong place.


Resources of quill needs to be added to your application. Example setup with CLI is as follows;

npm install quill --save

Add Quill to scripts in angular.json

"scripts": [... "node_modules/quill/dist/quill.js"],

Add Quill css to styles in angular.json

"styles": [ ... "node_modules/quill/dist/quill.core.css", "node_modules/quill/dist/quill.snow.css"],

I have checked this solution multiple times with new and existing projects, it works like charm :)