PrimeNg Editor is not showing up - Angular

守給你的承諾、 提交于 2019-12-06 09:45:17

Just now I created a project for PrimeNg Editor

  1. Created new angular project with latest Version 6
  2. npm install primeng --save latest > 6.0.0

  3. npm install quill --save

  4. Edit angular.json. Update it carefully If Your angular.json and node_module are at same level of tree. The Edit like below I edited like this :

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

  5. Import it in your module: import {EditorModule} from 'primeng/editor';

    imports: [ HttpModule, FormsModule, BrowserModule, ButtonModule, TableModule, EditorModule ],

  6. Add html in any of the template <p-editor [(ngModel)]="text1" [style]="{'height':'320px'}"></p-editor> <p>Value: {{text1||'empty'}}</p>

  7. And in component file give some value to text1: string text2: string;

Github repo for reference Git

Kamlesh

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 angular 7 and existing projects, it works like charm :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!