Kun*_*the 5 validation model-driven validationmessage angular
我知道有很多问题可以解决这个特殊的错误,但在尝试了这些解决方案的组合后,没有人倾向于帮助这个包.
ng2-mdf-validation-messages - https://www.npmjs.com/package/ng2-mdf-validation-messages
在GitHub上还有一个问题仍然存在 - https://github.com/d-kostov-dev/ng2-mdf-validation-messages/issues/12
针对不同软件包的各种解决方案提到了导出函数并将其包含在内,useFactory但我没有得到为这个特定软件包编写的内容.
例如:
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
}
],
})
Run Code Online (Sandbox Code Playgroud)
如果尝试使用创建的全新应用程序,它仍会出现错误ng.
编辑任何文件并保存后解决错误,之后一切正常,但不是第一次.
使用Angular 4和此插件添加带有全新安装的示例代码.
可在以下网址获得 - https://github.com/kunaldethe/ng4-mdf-validation-messages-example
组态:
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
Run Code Online (Sandbox Code Playgroud)
任何帮助表示赞赏.
| 归档时间: |
|
| 查看次数: |
197 次 |
| 最近记录: |