aitboudad
Repos
136
Followers
325
Following
11

📝 JSON powered / Dynamic forms for Angular

2359
479

Automatic page loading / progress bar for Angular

722
83

The Symfony PHP framework

27486
8584

Events

closed issue
Bug during deploy on server

Im having a bug during deploy process. Pipeline is giving the below error. Have tried to downgrade ts to version 4.7.4 and the same issue.

"target": "es2020",
"module": "es2020",

"lib": ["es2018", "dom"]

image

Created at 1 day ago
issue comment
Bug during deploy on server

Command failed with exit code 137

The error here seems related build script which run out of memory and not related to Formly.

Created at 1 day ago
delete branch
aitboudad delete branch issue_3448
Created at 1 day ago

docs: add expression changes event section

fix #3448

Created at 1 day ago
pull request closed
docs: add expression changes event section

fix #3448

Created at 1 day ago
issue comment
Formly angular with Bootstrap is finicky.

Hi, we need more details in order to help. Since it's a starting example, could you please push it in a separate repository so we may check it or show us the error that you're getting to see if we can help.

Thank you!

Created at 1 day ago

docs: add expression changes event section

fix #3448

Created at 2 days ago
issue comment
Is that possible to run the hook onInit only when we unhide the field?

This give an all new level of possibilities heart_eyes Is that new?

no, expressionChanges was introduced since v5.9. I've sent a new doc PR (https://github.com/ngx-formly/ngx-formly/pull/3450) hope it'll be clear!

Do you know the list of types for which a new event is emit?

hidden, expressionChanges and valueChanges.

Created at 2 days ago
pull request opened
docs: add expression changes event section

fix #3448

Created at 2 days ago
create branch
aitboudad create branch issue_3448
Created at 2 days ago

docs(demo): update v6 version link

docs(demo): update schematics install for v5

docs(demo): use demo url of v5 branch

fix(core): detect change of expressionChanges in formlySelectOptions

fix #3420

chore(release): 5.12.7

chore: merge branch 'v5'

Created at 2 days ago
issue comment
ExpressionProperties to conditionnally disable one option in a multicheckbox field

This issue has been fixed and released as part of v5.12.7 release.

Please let us know, in case you are still encountering a similar issue/problem. Thank you!

Created at 3 days ago
aitboudad create tag v5.12.7
Created at 3 days ago

chore(release): 5.12.7

Created at 3 days ago
issue comment
What is the best approach for reusable sub-forms?

Note: In v6 a new approach is introduced for reusable sub-forms: formly.dev/docs/guide/formly-field-presets.

Created at 3 days ago
closed issue
Best practice to reuse in formly field

Hi ,

I have a FormlyFieldConfig object contain many fields some field contain a service lik select . My question is what's best approach to reuse field in formly ? How to inject service in extension field? @aitboudad

Created at 3 days ago
issue comment
Best practice to reuse in formly field

see https://formly.dev/docs/guide/formly-field-presets

Created at 3 days ago
issue comment
Is that possible to run the hook onInit only when we unhide the field?

@Jukien can you try with field.options.fieldChanges which emit a new value when an expression is changed.

Created at 5 days ago
issue comment
Form `valueChanges` is triggered upon initialization without any values being changed

there is no validator in my example.

it does, for example required property is a validator.

I do not understand your workaround.

I means instead of using this.form.valueChanges, you could use (modelChange) output to get notified about value changes

- <formly-form ...></formly-form>
+ <formly-form (modelChange)="onModelChange($event)" ...></formly-form>

...

  ngOnInit(): void {
-   this.form.valueChanges
-     .subscribe((v) => console.log('formly form sub', v));
  }
  
+ onModelChange(v)
+ {
+   console.log('formly form sub', v)
+ }

Angular does not fire it nor it is logical for it to happen.

In Angular there is no way to update field validity without updating the value, we rely on updateValueAndValidity function so that's source of the issue.

Anyway I may give it another try next week to see if I can find a workaround.

Created at 1 week ago
closed issue
a reference to the host component

is there anyway to get a reference to the host component that hosts formly

// a custom formly field
@Component({
  selector: "formly-button",
  template: ` <button   (click)="to.onClick(hosted)" > example </button>`,
})
export class ButtonComponent extends FieldType {}

the host component

@component(){
...
}
export class MyComponent{
 fields;
 ngOnInit(){
   this.fields=require('./fields).fields
}

fields.js

export let fields = [{
     key: 'example',
    type: 'button',
   templateOptions:{
     onClick(host){
       console.log(host) //<-------------- should logs MyComponent
      }}
   }]

use case I want to update this.fields in MyComponent when fields in fields.js modified

Created at 1 week ago
issue comment
a reference to the host component

Sorry but the use-case is not clear to me and seems a little strange but anyway since the host component is controlled by your side you may just pass it through options input which will be available in field.options

Created at 1 week ago
issue comment
Duplicating a control removes required validation from another form control (JSON powered form)

Right now we rely on hideExpression and expressionProperties for JSON SCHEMA implementation, the security issue for expressions concern only when passing a string value which is not the case for JSON SCHEMA.

The solution for your case is to disallow passing string for hideExpression and expressionProperties.

Created at 1 week ago
closed issue
Duplicating a control removes required validation from another form control (JSON powered form)

Hi there, I just noticed that in my application one of the controls, which can be set to required, has the required status removed once a different control gets duplicated (a custom component that uses FieldArrayType). So the required field is no longer actually required when one repeats the other control. These two controls, aside from being in the same form, do not interact with one another (at least not in my own code).

Due to security policies I cannot use expressionProperties in the JSON to carry out the needed logic to determine if the field should be required. Also, I'm setting required: true in the NgAfterViewInit lifecycle hook of the component... I know there are other ways to do this but because this particular component in my actual app requires a lot of logic to determine if the component should be required/disabled or not, I'd prefer to leave it there if possible.

I created a much more simplified demo in Stackblitz to demonstrate the issue: https://stackblitz.com/edit/angular-9-starter-dvggab

Repeating component: formly-guest-information.ts Component with the required issue: signature.component.ts

image

Any ideas would be much appreciated, I haven't been able to figure out why this is happening.

Created at 1 week ago
closed issue
Form `valueChanges` is triggered upon initialization without any values being changed

Description Some time after v5.10.28 valueChanges on the form started triggering upon initialization.

EDIT: 5.10.30 introduces the change

Latest v5.12.6 and v6.0.0 trigger `valueChanges'

Minimal Reproduction https://github.com/gkamperis/formly-bug/tree/value-changes

npm run test -- --watch passes for 5.10.28

Code contains 2 forms, one passed to formly and the other one untouched. Formly introduces this behaviour.

Created at 1 week ago
issue comment
Form `valueChanges` is triggered upon initialization without any values being changed

We're tying to avoid a such trigger but unfortunately its not possible due to the form value is changed when a validator is updated which is the case during the build step.

Instead I would suggest to rely on (modelChange) output:

<formly-form (modelChange)="onModelChange($event)" ...</formly-form>
Created at 1 week ago
closed issue
modelChange event on formly-form tag doesn't fire when I change the model

Description When I change the model, the modelChange event not fire:

<formly-form [model]="model" [fields]="fields" [options]="options" [form]="form" (modelChange)="onModelChange()">
...
onModelChange() {
    console.log('in onModelChange');
}
...
<button (click)="changeModel()">change model</button>
..
changeModel() {
    this.model = { text: 'new text' };
 }
...

...

Minimal Reproduction

https://stackblitz.com/edit/angular-b43wet?file=src%2Fapp%2Fapp.component.ts

Your Environment

  • Angular version: 14.1.2
  • Formly version: 6.0.0-rc2
Created at 1 week ago
issue comment
modelChange event on formly-form tag doesn't fire when I change the model

That's an expected behavior, when you change the model manually we assume that is an initial value and already known from your side.

For a solution to your needs you may just call onModelChange manually:

changeModel() {
   this.model = { text: 'new text' };
+  this.onModelChange...;
}
Created at 1 week ago
closed issue
ExpressionProperties to conditionnally disable one option in a multicheckbox field

Hello! I have two multicheckbox fields and I would like to conditionnaly disable options from one to the other according on the selection that is made Screenshot from 2022-08-18 14-17-47

For example : When I select the first option on the first multicheckbox field (Jane), I would like that the first option on the second one get disabled, and reciprocally

I tried expressionProperties in order to achieve this but It seems that even if the option get the new field 'disabled : true' , the form is not getting updated if the modification happen after init

Here is an exemple : https://stackblitz.com/edit/ngx-formly-ui-bootstrap-bgvozp?file=src/app/app.component.ts

note : this is working fine if I want to disable conditionnally all the options of the checkbox list but not If I want to disable only one option. Would you know how to make it work?

Created at 1 week ago
delete branch
aitboudad delete branch issue_3420
Created at 1 week ago