I am trying to use ngx-highlightjs and I have the following code in the module file. I have multiple modules and so I am importing the HighlightModule, in the module in which the highlighting functionality is needed. So the following code is not in App Module.
import { HighlightModule, HIGHLIGHT_OPTIONS, HighlightOptions} from 'ngx-highlightjs';
@NgModule({
declarations: [
EnvironmentComponent,
RepositoryComponent
],
imports: [
CommonModule,
SharedModule,
HighlightModule
],
providers: [
EnvironmentService,
AuthService,
{
provide: HIGHLIGHT_OPTIONS,
useValue: {
coreLibraryLoader: () => import('highlight.js/lib/core'),
lineNumbersLoader: () => import('highlightjs-line-numbers.js'),
languages: {
typescript: () => import('highlight.js/lib/languages/typescript'),
css: () => import('highlight.js/lib/languages/css'),
xml: () => import('highlight.js/lib/languages/xml')
}
}
}
],
})
and in the component template, I have the code like this :
<pre><code [highlight]="fileData" (highlighted)="onHighlight($event)"></code></pre>
Now I am getting the following error and the output is not showing :
Can't bind to 'highlight' since it isn't a known property of 'code'
How can I fix this ?