NullInjectorError: No provider for SchemaValidatorFactory
See original GitHub issueI just recreated the example but I immediately got the following error: Any clue on what could be wrong?
ERROR Error: StaticInjectorError[SchemaValidatorFactory]:
StaticInjectorError[SchemaValidatorFactory]:
NullInjectorError: No provider for SchemaValidatorFactory!
at _NullInjector.get (core.js:993)
at resolveToken (core.js:1281)
at tryResolveToken (core.js:1223)
at StaticInjector.get (core.js:1094)
at resolveToken (core.js:1281)
at tryResolveToken (core.js:1223)
at StaticInjector.get (core.js:1094)
at resolveNgModuleDep (core.js:10878)
at NgModuleRef_.get (core.js:12110)
at resolveDep (core.js:12608)
My setup is simple:
app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
// Bind the 'mySchema' member to the schema input of the Form component.
template: '<sf-form [schema]="mySchema"></sf-form>'
})
export class AppComponent {
// The schema that will be used to generate a form
mySchema = {
'properties': {
'email': {
'type': 'string',
'description': 'email',
'format': 'email'
},
'password': {
'type': 'string',
'description': 'Password'
},
'rememberMe': {
'type': 'boolean',
'default': false,
'description': 'Remember me'
}
},
'required': ['email', 'password', 'rememberMe']
};
}
app.module.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { SchemaFormModule, WidgetRegistry, DefaultWidgetRegistry } from 'angular2-schema-form';
import { AppComponent } from './app.component';
@NgModule({
imports: [
SchemaFormModule,
BrowserModule
],
declarations: [AppComponent],
providers: [{provide: WidgetRegistry, useClass: DefaultWidgetRegistry}],
bootstrap: [AppComponent]
})
export class AppModule {}
Issue Analytics
- State:
- Created 6 years ago
- Comments:6
Top Results From Across the Web
NullInjectorError: No provider for class - angular - Stack Overflow
I have injected class as dependency injection in component class and get an error. NullInjectorError: No provider for class.
Read more >nullinjectorerror: no provider for service
You might have faced an error like " StaticInjectorError NullInjectorError: No provider for MyService". This error comes when you try to create a...
Read more >ng-alain_plia的博客-CSDN博客_ng-alain
... SchemaValidatorFactory]: NullInjectorError: No provider for SchemaValidatorFactory! at _NullInjector.get (core.js:1003) at resolveToken ...
Read more >Top 5 ngx-schema-form Code Examples - Snyk
To help you get started, we've selected a few ngx-schema-form examples, based on popular ways it is used in public projects. Secure your...
Read more >No provider for MockClientService - DevAsking
To fix NullInjectorError: No provider for HttpClient! error in Angular follow the ... StaticInjectorError[SchemaValidatorFactory]: NullInjectorError: No ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome, exactly what I was looking for, “SchemaFormModule.forRoot()” worked for me
Yep, like told in #173 the import must be now be rewritten this way, to have the default
SchemaValidatorFactory
working.