Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Quill Angular Error: NullInjectorError: No provider for InjectionToken config

I updated all my node modules and when quill updated, all my editors broke in my application. The error "NullInjectorError: No provider for InjectionToken config!" appeared.

I Have fixed this problem! Just wanted to share with other ppl who might be in the same boat.

You need to add the QuillModule (import { QuillModule } from 'ngx-quill';) to the App Module 'Imports' section (or whatever module you are using). For me, I also needed to add .forRoot() to make it work

imports: [
    QuillModule.forRoot(),
],

Again, this works for me, just letting you all know in case you encounter the same problem updating ngx-quill to the newest version

like image 778
NathanCaleWichman Avatar asked Nov 08 '19 18:11

NathanCaleWichman


People also ask

Why do I get nullinjectorerror when using angular runtime?

Angular runtime gives error-nullinjectorerror: no provider for httpclient! NullInjectorError: No provider for HttpClient! The issue is more due to not registering the required services i.e HttpClientModule in the root module ie. NgModule.

Why do I get nullinjectorerror no provider for HTTP client?

Angular runtime gives error-nullinjectorerror: no provider for httpclient! NullInjectorError: No provider for HttpClient! The issue is more due to not registering the required services i.e HttpClientModule in the root module ie.

Should I use an injectiontoken instead of ngoninit?

For this I'm using an Injector, and loading the the service during ngOnInit. This works fine when using a string based provider, however my IDE notes that it's deprecated and I should use an InjectionTokenwhich I can't seem to wrap my head around.

Should I use an injectiontoken or a string based provider?

This works fine when using a string based provider, however my IDE notes that it's deprecated and I should use an InjectionTokenwhich I can't seem to wrap my head around. I expected the following code to work, as removing all instances of InjectionTokenand replacing them with the direct string literal works:


1 Answers

First You have to import QUILL_CONFIG_TOKEN from 'ngx-quill' library after that you have to pass this class to inject eg QuillModule.forRoot(QUILL_CONFIG_TOKEN.ngInjectableDef)

like image 118
hassan naseer Avatar answered Sep 30 '22 17:09

hassan naseer