tanepiper / ngx-tinynodes

Monorepo for components released on NPM @tinynodes
https://tanepiper.github.io/ngx-tinynodes/
Other
37 stars 15 forks source link

[BUG] <ngx-editorjs - 3.1.0>: Can't bind to 'holder' since it isn't a known property of 'ngx-editorjs-mat-field'. #16

Closed vrxj81 closed 4 years ago

vrxj81 commented 4 years ago

I'm getting the following errors when trying to build my form using ngx-editorjs:

Can't bind to 'holder' since it isn't a known property of 'ngx-editorjs-mat-field'.
1. If 'ngx-editorjs-mat-field' is an Angular component and it has 'holder' input, then verify that it is part of this module.
2. If 'ngx-editorjs-mat-field' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.
3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component. ("
    <mat-form-field>
        <ngx-editorjs-mat-field [id]="holder"
        [ERROR ->][holder]="holder"
        formControlName="pageEditor"
        [blocks]="blocks | async"
"): ng:///CoreModule/PagesComponent.html@3:2

This is the app.module.ts:

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { NgxEditorJSModule } from '@tinynodes/ngx-editorjs';

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
import { MatGridListModule } from '@angular/material/grid-list';
import { MatCardModule } from '@angular/material/card';
import { MatMenuModule } from '@angular/material/menu';
import { MatIconModule } from '@angular/material/icon';
import { MatButtonModule } from '@angular/material/button';
import { LayoutModule } from '@angular/cdk/layout';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MatSidenavModule } from '@angular/material/sidenav';
import { MatListModule } from '@angular/material/list';

import { CoreModule } from './core/core.module';
import { CoreRoutingModule } from './core/core-routing.module';
import { NgxEditorjsPluginsModule } from '@tinynodes/ngx-editorjs-plugins';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    AppRoutingModule,
    BrowserAnimationsModule,
    MatGridListModule,
    MatCardModule,
    MatMenuModule,
    MatIconModule,
    MatButtonModule,
    LayoutModule,
    MatToolbarModule,
    MatSidenavModule,
    MatListModule,
    NgxEditorJSModule.forRoot({
      // Optional Configuration, see all keys below
      editorjs: {
        autofocus: false,
        holder: 'editor',
        initialBlock: 'paragraph',
        data: {
          time: Date.now(),
          blocks: []
        }
      }
    }),
    NgxEditorjsPluginsModule,
    CoreModule,
    CoreRoutingModule,
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

The component class:

import { Component, OnInit } from '@angular/core';
import { FormGroup, FormControl } from '@angular/forms';

@Component({
  selector: 'app-pages',
  templateUrl: './pages.component.html',
  styleUrls: ['./pages.component.scss']
})
export class PagesComponent implements OnInit {

  editorForm: FormGroup;

  constructor() { }

  ngOnInit() {
    this.editorForm = new FormGroup({
      pageEditor: new FormControl('')
    });
  }

}

And the component template:

<form [formGroup]="editorForm">
    <mat-form-field>
        <ngx-editorjs-mat-field [id]="holder"
        [holder]="holder"
        formControlName="pageEditor"
        [blocks]="blocks | async"
        placeholder="EditorJS for Page Name">
        </ngx-editorjs-mat-field>
    </mat-form-field>
</form>

I'm sure I'm being thick here, but could you point me to the solution?

tanepiper commented 4 years ago

@vrxj81 The error is right there, holder isn't a property of the component. You only need to pass id