I know that there are a lot of questions answered for this particular error but after trying out the combination of those solutions, none tend to help with this package.
ng2-mdf-validation-messages - https://www.npmjs.com/package/ng2-mdf-validation-messages
There is also an issue still open on GitHub for the same - https://github.com/d-kostov-dev/ng2-mdf-validation-messages/issues/12
Various solutions for different packages mention to export a function and include it via useFactory
but I am not getting as what to write for this particular package.
Eg:
import { Ng2MDFValidationMessagesModule } from 'ng2-mdf-validation-messages';
export function Ng2MDFValidationMessagesModuleFactory() {
return Ng2MDFValidationMessagesModule.globalConfig({
class: 'text-danger',
defaultErrorMessages: {
required: 'Default Custom Required Message'
}
});
}
@NgModule({
...
providers: [
{
provide: Ng2MDFValidationMessagesModule,
useFactory: Ng2MDFValidationMessagesModuleFactory
}
],
})
It still gives the error if tried on a completely new app created with ng
.
After editing any file and saving resolves the error and everything works fine afterwards but not for the first time.
Add a sample code with fresh install using Angular 4 and this plugin.
Available at - https://github.com/kunaldethe/ng4-mdf-validation-messages-example
Configuration:
1. node -v (v6.11.0)
2. npm -v (5.4.2)
3. ng --version
@angular/cli: 1.4.9
node: 6.11.0
os: win32 x64
@angular/animations: 4.4.6
@angular/common: 4.4.6
@angular/compiler: 4.4.6
@angular/core: 4.4.6
@angular/forms: 4.4.6
@angular/http: 4.4.6
@angular/platform-browser: 4.4.6
@angular/platform-browser-dynamic: 4.4.6
@angular/router: 4.4.6
@angular/cli: 1.4.9
@angular/compiler-cli: 4.4.6
@angular/language-service: 4.4.6
typescript-formatter: 5.2.0
typescript: 2.3.4
Any help is appreciated.