Skip to content

Commit

Permalink
feat(core): deprecate passing immutable attr to formly-form component (
Browse files Browse the repository at this point in the history
  • Loading branch information
aitboudad committed Oct 9, 2019
1 parent 0f168f7 commit 61f9391
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
18 changes: 18 additions & 0 deletions UPGRADE-5.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,24 @@ After:
<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:
```html
<formly-form immutable></formly-form>
```

After:
```ts
@NgModule({
imports: [
FormlyModule.forRoot({
extras: { immutable: true }
}),
],
})
```

@ngx-formly/material
--------------------
**Note**: this only affect the user's who import sub-modules of `@ngx-formly/material` instead of main module `FormlyMaterialModule`.
Expand Down
1 change: 1 addition & 0 deletions demo/src/app/examples/introduction/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { FormlyFieldCustomInput } from './custom-input.component';
ReactiveFormsModule,
FormlyBootstrapModule,
FormlyModule.forRoot({
extras: { immutable: true },
validationMessages: [
{ name: 'required', message: 'This field is required' },
],
Expand Down
4 changes: 4 additions & 0 deletions src/core/src/lib/components/formly.form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,10 @@ export class FormlyForm implements DoCheck, OnChanges, OnDestroy {
@Attribute('immutable') immutable,
@Optional() private parentFormGroup: FormGroupDirective,
) {
if (immutable !== null) {
console.warn(`NgxFormly: passing 'immutable' attribute to 'formly-form' component is deprecated since v5.5, enable immutable mode through NgModule declaration instead.`);
}

this.immutable = (immutable !== null) || !!formlyConfig.extras.immutable;
}

Expand Down

0 comments on commit 61f9391

Please sign in to comment.