Before:
import {FormlyModule, FormlyBootstrapModule} from 'ng-formly';
After:
import {FormlyModule} from '@ngx-formly/core';
import {FormlyBootstrapModule} from '@ngx-formly/bootstrap';
The FormlyPubSub
service has been removed:
constructor(private fieldSubject: FormlyPubSub) {}
ngOnInit() {
this.fieldSubject.getEmitter(this.key).subscribe(event => {
// ....
})
}
constructor() {}
ngOnInit() {
this.options.fieldChanges.subscribe(event => {
// ....
})
}
The FormlyValidationMessages
service has been removed:
import { FormlyValidationMessages } from '@ngx-formly/core';
...
constructor(private formlyMessages: FormlyValidationMessages) {}
test(): string {
this.formlyMessages.addStringMessage('required', 'This field is required.');
this.formlyMessages.getValidatorErrorMessage('required');
}
import { FormlyConfig } from '@ngx-formly/core';
...
constructor(private formlyConfig: FormlyConfig) {}
test(): string {
this.formlyConfig.addValidatorMessage('required', 'This field is required.');
this.formlyConfig.getValidatorMessage('required');
}
valid
has been replaced by showError
:
<div *ngIf="!valid"></div>
<div *ngIf="showError"></div>