问题描述
我正在尝试在primeng中使用编辑器控件: https://www.primefaces.org/primeng/#/editor
I am trying to use the editor control in primeng: https://www.primefaces.org/primeng/#/editor
但是我得到了错误:
我的项目使用:
- 角度Cli:1.4.1
- 角度:4.3.6
- NPM:5.4.1
- 节点:6.10.0
- PrimeNG:4.2.0
我发现了此问题: https://github.com/primefaces/primeng/issues/807
我按照说明进行操作:
import {EditorModule} from 'primeng/primeng';
安装软件包:
npm install quill --save
npm install @types/quill --save
更新angular-cli.json
"styles": [ "../node_modules/quill/dist/quill.core.css", "../node_modules/quill/dist/quill.snow.css", ], "scripts": [ "../node_modules/quill/dist/quill.js" ],
,但仍然存在相同的问题.我只是添加默认标记:
but it still has the same issue. I am just adding default markup:
<p-editor [(ngModel)]="text" [style]="{'height':'320px'}"></p-editor>
我得到了错误,看起来像这样:
And I get the error and it looks like this:
该线程上唯一没有尝试过的事情是安装webpack插件,因为我使用的是cli,我认为这不是一个选择.
The only thing on that thread I didn't try is installing the webpack plugin because I am using angular cli I don't think that is an option.
该如何解决?
推荐答案
尝试一下:它非常适合我
Try This: it's working for me perfectly
版本:
Node : 7.9.0
angular/cli: 1.3.0
angular: 4.3.6
npm: 4.2.0
primeng": "^4.2.0-rc.1"
安装节点模块主轴
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;
}
这篇关于PrimeNg错误:未定义套管的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!