-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
I followed the instruction but and got "Can't find hljs under window" warning in console. So what i did:
- Add in my app.module.ts
import {HIGHLIGHTJS_CONFIG, HighlightJsConfig, HighlightJsModule} from 'ngx-highlight-js';
@NgModule({
declarations: [
AppComponent,
QuestionPageComponent,
QuestionComponent
],
imports: [
BrowserModule,
AppRoutingModule,
ReactiveFormsModule,
HighlightJsModule,
],
providers: [
{
provide: HIGHLIGHTJS_CONFIG,
useValue: {
lang: 'html'
} as HighlightJsConfig
}
],
bootstrap: [AppComponent]
})
export class AppModule { }
- Download css/js and create local highlight.css/highlight.js
im my component:
@Component({
selector: 'app-question',
templateUrl: './question.component.html',
styleUrls: [
'./question.component.css',
'./question.component-bar.css',
'./question.component-media.css',
'./highlight.component.css'
]
})
in angular.json
"scripts": [
"src/assets/highlight.js"
]
p.s. also i tried adding urls to cnd in html file.
And in component.html
<textarea highlight-js [lang]="'typescript'">
/* tslint:disable */
import { Component } from '@angular/core';
@Component({
selector: 'demo',
templateUrl: './demo.component.html',
styleUrls: ['./demo.component.scss']
})
export class DemoComponent {
switchStatus: boolean = true;
}
</textarea>
And no render and warning about hljs in console. Do you have any ideas?
Metadata
Metadata
Assignees
Labels
No labels