JayChase / angular2-highlight-js

highlight.js integration with Angular
MIT License
21 stars 9 forks source link

hljs is not defined in Angular CLI with service #11

Closed Dok11 closed 7 years ago

Dok11 commented 7 years ago

Angular CLI. ver.4 Error ERROR ReferenceError: hljs is not defined:

image image

And my code:

_setBlog(post) { // from route subscribe() therefore setTimeout();
    this.post = post;
    setTimeout(() => {
        this.highlightJsService.highlight(this.el.nativeElement.querySelectorAll('pre>code'));
    }, 10);
}
JayChase commented 7 years ago

Hi. This is normally an issue with highlight,js not having been loaded. Please see the demo plunk and recreate if necessary using it.