Angular Froala _this ._ $ element.froalaEditor не является функцией - PullRequest
0 голосов
/ 12 июня 2018

Я прочитал все ответы как на SO, так и на git, чтобы выяснить, почему froalaEditor не работает в моем проекте.

Вот мои настройки:

Я установил плагин с помощью

npm install angular-froala-wysiwyg --save

Затем в моем .angular-cli.json:

"styles": [
    "styles.scss",
    "../node_modules/froala-editor/css/froala_editor.pkgd.min.css",
    "../node_modules/froala-editor/css/froala_style.min.css"
  ],
"scripts": [
    "../node_modules/froala-editor/js/froala_editor.pkgd.min.js"

  ],

Затем в моем модуле:

import {FroalaEditorModule, FroalaViewModule} from 'angular-froala-wysiwyg';

 @NgModule({
    imports: [
        HttpClientModule, CommonModule, RouterModule.forChild(routes), LayoutModule, FormsModule, ReactiveFormsModule, DropzoneModule,
        FroalaEditorModule.forRoot(), FroalaViewModule.forRoot()

    ], exports: [
        RouterModule,
    ], declarations: [
        ContentMakerComponent,
        VideoElementComponent,
        TextElementComponent,
        MultipleChoiceElementComponent,
        SoundElementComponent,
        DocumentElementComponent
    ],
    providers: [
        {
            provide: DROPZONE_CONFIG,
            useValue: DEFAULT_DROPZONE_CONFIG
        }
    ]
})

А затем в моем компоненте:

<div [froalaEditor]>Hello, Froala!</div>

Теперь, когда я открываю компонент, я получаю:

ERROR TypeError: _this._$element.froalaEditor is not a function
at eval (editor.directive.js:167)
at ZoneDelegate.invoke (zone.js:388)
at Zone.run (zone.js:138)
at NgZone.runOutsideAngular (core.js:4708)
at FroalaEditorDirective.createEditor (editor.directive.js:166)
at FroalaEditorDirective.ngOnInit (editor.directive.js:244)
at checkAndUpdateDirectiveInline (core.js:12411)
at checkAndUpdateNodeInline (core.js:13935)
at checkAndUpdateNode (core.js:13878)
at debugCheckAndUpdateNode (core.js:14771)

Кто-нибудь может помочь?

...