Note: this only affect the user's who create a custom field type.
- Custom field type
FieldType: in case of creating a custom field that extendFieldType, callingsuper.{ngOnInit, ngOnChanges, ngDoCheck, ngAfterViewInit, ngOnDestroy}is not allowed anymore.
Before:
export class CustomFormlyField extends FieldType {
ngOnInit() {
super.ngOnInit();
...
}
}After:
export class CustomFormlyField extends FieldType {
ngOnInit() {
...
}
}FormlyValidationMessage: the deprecatedfieldForminput is removed
Before:
<formly-validation-message [field]="field" [fieldForm]="formcontrol"></formly-validation-message>After:
<formly-validation-message [field]="field"></formly-validation-message>- rename
FieldtoFieldType
Before:
import { Field } from '@ngx-formly/core';After:
import { FieldType } from '@ngx-formly/core';- passing
model,optionsandforminputs toformly-fieldcomponent is not required anymore:
Before:
<formly-field [form]="form" [field]="field" [options]="options" [model]="model"></formly-field>After:
<formly-field [field]="field"></formly-field>- using
createControlto create custom form control is deprecated, useprePopulatehook instead:
Before:
export class FormlyFieldCustomType extends FieldType {
static createControl(model: any, field: FormlyFieldConfig): AbstractControl {
return new FormControl(...);
}
}After:
export class FormlyFieldCustomType extends FieldType {
prePopulate(field: FormlyFieldConfig) {
if (field.formControl) {
return;
}
field.formControl = new FormControl(...);
}
}lifecycleoption has been renamed tohookswith a change in the callback signature:
Before:
fields = [
{
key: 'email',
...
lifecycle: {
onInit: (form, field, model, options) => {
...
},
},
},
]After:
fields = [
{
key: 'email',
...
hooks: {
onInit: (field) => {
const { form, model, options } = field;
...
},
},
},
]Warning: onChanges under hooks doens't take account of model, options and form changes (ngx-formly#1241).
manipulatorsconfig is deprecated in favor ofextension:
Before:
FormlyModule.forRoot({
manipulators: [{ method: 'run', class: TemplateAddons }],
})After:
FormlyModule.forRoot({
extensions: [{ name: 'addons', extension: addonsExtension }],
})- Passing content inside the 'formly-form' tag is deprecated.
Before:
<formly-form>
<button>Submit</button>
</formly-form>After:
<formly-form></formly-form>
<button type="submit">Submit</button>- Passing 'immutable' attribute to 'formly-form' component is deprecated since v5.5, enable immutable mode through NgModule declaration instead.
Before:
<formly-form immutable></formly-form>After:
@NgModule({
imports: [
FormlyModule.forRoot({
extras: { immutable: true }
}),
],
})- Passing legacy select option
{key, value}is deprecated since v5.5, use{value, label}instead.
{
type: 'select',
templateOptions: {
options: [
-- { key: '1', value: 'label 1' },
++ { value: '2', label: 'label 2' },
],
}
}Note: this only affect the user's who import sub-modules of @ngx-formly/material instead of main module FormlyMaterialModule.
textarea: textarea is moved into a new sub-module namedFormlyMatTextAreaModuleand is not part ofFormlyMatInputModuleanymore.
Before:
import { FormlyMatInputModule } from '@ngx-formly/material/input';After:
import { FormlyMatInputModule } from '@ngx-formly/material/input';
import { FormlyMatTextAreaModule } from '@ngx-formly/material/textarea';multicheckbox: multicheckbox is moved into a new sub-module namedFormlyMatMultiCheckboxModuleand is not part ofFormlyMatCheckboxModuleanymore.
Before:
import { FormlyMatCheckboxModule } from '@ngx-formly/material/checkbox';After:
import { FormlyMatCheckboxModule } from '@ngx-formly/material/checkbox';
import { FormlyMatMultiCheckboxModule } from '@ngx-formly/material/multicheckbox';-
the deprecated wrappers ('label', 'fieldset', 'description', 'validation-message') has been removed, you may use
form-fieldinstead (for a smooth upgrade, ensure updating to version4.7first) -
bootstrap v3 support is removed, so if you still using the v3 you may check the migrating to v4 https://getbootstrap.com/docs/4.0/migration/
The library now require the Ionic V4 (https://blog.ionicframework.com/announcing-ionic-4-beta/).