Blog on software engineering
How to fix: Can’t bind to ‘data’ since it isn’t a known property of ‘markdown’

How to fix: Can’t bind to ‘data’ since it isn’t a known property of ‘markdown’

After an Angular 11 update, the code:

<markdown
[data]=“model.someText”></markdown>

 

would throw an exception “Can’t bind to ‘data’ since it isn’t a known property of ‘markdown'” only in production builds.

Fixed this by adding

@NgModule({
  ...
  imports: [
    ...
    ...

                MarkdownModule.forRoot(),
  ],
  ...
})
export class AppModule {}

 

 

In the AppModule en in de Module containing the component with the template using the “markdown” tag, added:

 

@NgModule({
  ...
  imports: [
    ...

                , MarkdownModule.forChild()
                
  ],
  ...
})
export class CoreModule { }

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.