Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 06:25
    renovate[bot] edited #2326
  • Sep 24 20:08
    aitboudad closed #2979
  • Sep 24 20:08
    aitboudad commented #2979
  • Sep 24 20:05
    aitboudad commented #2988
  • Sep 24 20:02
    aitboudad labeled #2989
  • Sep 24 20:02
    aitboudad commented #2989
  • Sep 24 09:05
    philhaller opened #2989
  • Sep 24 07:02
    sranjan-m commented #2988
  • Sep 24 07:02
    sranjan-m commented #2988
  • Sep 24 06:22
    renovate[bot] edited #2326
  • Sep 24 04:56
    sranjan-m closed #2988
  • Sep 24 04:56
    sranjan-m commented #2988
  • Sep 24 02:58
    sranjan-m reopened #2988
  • Sep 24 02:58
    sranjan-m commented #2988
  • Sep 23 18:16
    sranjan-m closed #2988
  • Sep 23 18:16
    sranjan-m commented #2988
  • Sep 23 18:08
    kenisteward commented #2988
  • Sep 23 17:55
    sranjan-m commented #2988
  • Sep 23 16:34
    kenisteward commented #2988
  • Sep 23 16:13
    kenisteward unlabeled #2988
abhip5369
@abhip5369

@abhip5369 seems there a bug somewhere 🤔, could you please fill an issue in Formly repo

Sure @aitboudad

abhip5369
@abhip5369

@abhip5369 seems there a bug somewhere 🤔, could you please fill an issue in Formly repo

As requested, ngx-formly/ngx-formly#2808. Please let me know, if I need to provide additional info & edit anything. Note: In Environment I filled : "Angular-v11 | Stackbliz" as I am not sure what to fill there.

smohanui
@smohanui
Hi @aitboudad , thank you for your reply.
I updated as suggested but still same behavior.
submit > Ok => formdata is resetting
submit > Edit > submit > Ok => formdata is not resetting
can you please help me how can i reset form data from script ?
For reproduction : stackBlitz
Garet Jax
@ankurkhairatkar_twitter

Hi, I want to show a custom validation message, that selected option for select type is 'inactive'. How can I validate the default value of a select type (set after an observable of options has been returned) in edit flow? The options structure is as follows,
[
{id: 1, name: 'abc', isactive: false}
]
I want to validate the selected option or the default value against the 'isactive' flag.

Thanks

Aleix Suau
@aleixsuau
Hi,
I'd like to run "expressionproperties" when I submit the form or programatically, do you know if it is possible?
Mrigank Taxak
@mrigank_taxak_twitter
Can anyone please help me with the how-to use formly lifecycle hooks in JSON-schema, I want to call a backend API in my second field after selecting the option from first field using ID.
Dominic Watson
@intellix
are there any examples of using multiple inputs to create 1x value? For example I need to create an ISO Duration input:
[ Days ] [ Hours ] [ Minutes ] [ Seconds ] which outputs a value like: "P1D5M4S" - so to me that seems like an input with 4x text inputs, which emits 1x value when any of those change
I don't even know where to start with that within Angular itself to be honest, let alone doing it in Formly... maybe just a group of inputs and then process it in my submit? would be nice to have a custom input that outputs a text value
Dominic Watson
@intellix
I guess a simpler example would be like a Math field. You provide a value to [ a ] [ b ] and it returns them added together
Dominic Watson
@intellix
I think due to needing to parse the ISO Duration on input and convert multiple inputs into a single ISO Duration on any of the inputs changing, that I need a custom
ControlValueAccesor but then I'm not sure how to tie that into Formly
Dominic Watson
@intellix
Created this in raw Angular for multiple inputs for one Control: https://stackblitz.com/edit/angular-ivy-iso-duration-control-value-accessor
Dominic Watson
@intellix
dtienq
@dtienq
hello
Younes Manton
@ymanton
Is there a good example of a row/col layout on top of formly-material? All the examples I see are bootstrap-based.
Mrigank Taxak
@mrigank_taxak_twitter
I want to change the format model of data after selection from multicheckbox. it is coming now as a key value pair object but i want to produce it as a array of object, anyone can help ?
Younes Manton
@ymanton
@aitboudad Thanks, that helped.
Jörg Vanderhoeven
@jvdhoeven
hey everyone, i have a page with two independent formly forms with ng-zorro-ant UI. Both have the same formly configuration. After the form gets rendered, i get a warning that the generated id's of the inputs are duplicate. Is there any way how i could maybe prefix the ids?
Maybe by using an extention and prepopulate?
Jörg Vanderhoeven
@jvdhoeven
Ok, using an extention onPopulate works. i can set the prefix with formly options and prefix the field.id with it. Thanks anyways ;)
Sergey Koryshev
@Ace-Lightning
Hello, could you please give me an advice how to link lifecycle hooks with JSON-schema in formly?
Abdellatif Ait boudad
@aitboudad
Glauber Funez
@glauberfunez_twitter

Hi guys, I'm having the following problem after upgrading to V6
ngx-formly/ngx-formly#2960

I don't know if it can be something to any wrapper I have.

html example:

<ng-template #matPrefix></ng-template>
<ng-container #fieldComponent></ng-container>
<ng-template #matSuffix></ng-template>

typescript

@ViewChild('matPrefix') matPrefix: TemplateRef<any>;
@ViewChild('matSuffix') matSuffix: TemplateRef<any>;

ngAfterViewInit(): void {
         if (this.matPrefix) {
            Promise.resolve().then(() => (this.to.prefix = this.matPrefix));
        }

        if (this.matSuffix) {
            Promise.resolve().then(() => (this.to.suffix = this.matSuffix));
        }
    }
Abdellatif Ait boudad
@aitboudad
@glauberfunez_twitter @glauberfunez_twitter check the latest update here https://main.formly.dev/examples/other/material-prefix-suffix:
export class FormlyWrapperAddons extends FieldWrapper implements AfterViewInit {
  @ViewChild('matPrefix', { static: true }) matPrefix: TemplateRef<any>;
  @ViewChild('matSuffix', { static: true }) matSuffix: TemplateRef<any>;

  ngAfterViewInit() {
    if (this.matPrefix) {
      this.to.prefix = this.matPrefix;
    }

    if (this.matSuffix) {
      this.to.suffix = this.matSuffix;
    }
  }

  ...
}
Glauber Funez
@glauberfunez_twitter

I noticed some changes in V6, for example.
in V5 I had a type called autocomplete and it had a wraper around it with a loading.
So when I wanted to make the loading appear, I did it like this:

this.field.templateOptions = {
             ...this.field.templateOptions,
             loading: {
                 show: true
             }
         };

This at runtime, but it seems to me that it doesn't work now, I tried calling up to this.options.detectChanges(this.field); after the code above.
and in my html code in the wraper i have something like

<!-- Component Type -->
<ng-container #fieldComponent></ng-container>

<!-- MAT SUFFIX -->
<ng-template #matSuffix>
    <ng-container *ngIf="to.matSuffix || to.loading?.show">
        <!-- Loading -->
        <ng-container *ngIf="to.loading?.show">
            <div class="vimbo-mat-addons">
                <span class="spacer"></span>
                <span class="vimbo-mat-addons-suffix loading" [ngClass]="to.loading?.className" [ngStyle]="to.loading?.theme">
                    <mat-progress-spinner
                        class="mt-2"
                        [color]="'accent'"
                        [mode]="'indeterminate'"
                        [diameter]="20">
                    </mat-progress-spinner>
                </span>
            </div>
        </ng-container>
    </ng-container>
</ng-template>

Am I doing something wrong?

Abdellatif Ait boudad
@aitboudad
@glauberfunez_twitter that's a bug, please fill an issue in our repo
Glauber Funez
@glauberfunez_twitter
alright, i will do that.
Is the v6.0.0-next.1 version in your opinion stable enough to be used in production?
Glauber Funez
@glauberfunez_twitter
Abdellatif Ait boudad
@aitboudad
@glauberfunez_twitter it may contain some regression so I would wait until the beta version at least unless you need some of its features
Glauber Funez
@glauberfunez_twitter
I actually have scenarios that have very large objects nested, which in v5 doesn't work properly and in v6 after upgrading, it worked the first time.
example using FieldArrayType, if I call this.add() create the new position in the model, I can see it debugging, but it doesn't reflect to this.form.value for example.
seems to create only in this.model
Abdellatif Ait boudad
@aitboudad
@glauberfunez_twitter v6 is better than v5 in terms of performance, so the this.form.value is populated with a delay in v5 if I'm not wrong.
Glauber Funez
@glauberfunez_twitter
@aitboudad Yes, I really liked V6, but as I found some problems, I'm going to go back to v5 and leave V6 in another branch so I can keep up with the progress and test.
Another detail I observed in V6, blocks where in v5 it was hidden when it had no defined value, now in V6 it appears, for example the field does not appear, but the structure appears, hence the blank space where the field would occupy if it was visible on the screen .
Abdellatif Ait boudad
@aitboudad
@glauberfunez_twitter don't hesitate to report any issue related to those regressions, they are really helpful and will allow us to fix them before the final release.
Glauber Funez
@glauberfunez_twitter

@aitboudad That was my problem that made me go to V6, but I had to go back to V5.
I don't know if you have any idea what it could be.
ngx-formly/ngx-formly#2962

Remember that even some previous versions this worked, but I don't remember the version and migrating to v6 also works, so I believe it must be a bug in the library

Glauber Funez
@glauberfunez_twitter
@aitboudad Any suggestions on how to work around this issue until v6 is officially released ?
Robert
@wobbince
Hi, I'm trying to add a cascading select inside a repeater.
However, whenever I click add it is nulling out previously selected values. Am I missing something trivial here?
Here is an example: if anyone can point out what I am missing I'd be very grateful. Thanks
Robert
@wobbince
Sorry, this is the right link https://stackblitz.com/edit/angular-n7s2u6. If you add one and use the cascading selects then click add another, the team and player are reset but they stay set in the model
Gyan Satapathy
@gyansatapathy
Hi, I want to have a validator at the form level. Such that if any of the fields value change or if we add a repeat section the validator should be called
is there any way to do this?
Abdellatif Ait boudad
@aitboudad
Robert
@wobbince
Awesome thanks!
Nitin
@thenm
I am trying to create a typeahead referring this https://stackblitz.com/edit/angular-ngx-formly-typeahead-t7me2u
For static data I am getting the data but for the http request I am getting the result. In filtered array there are results.
pushTypeaheadSearchFormatField(element: any, index: any) {
    this.formFields.push({
      'key': element[index].name,
      'wrappers': ['labelWrapper'],
      'type': 'typeahead',
      'defaultValue': element[index].defaultValue,
      'templateOptions': {
        'type': 'typeahead',
        'key': element[index].name,
        'label': element[index].displayName,
        'required': element[index].isRequired && element[index].isRegulatoryRequirement ? false : element[index].isRequired,
        'isRegulatoryRequirement': element[index].isRegulatoryRequirement,
        'dependencyRules': element[index].dependencyRules,
        'showLookupNotice': element[index].isOptionRequired,
        'optionsUrl': element[index].optionsUrl,
        'changeExpr': 'this.getData($event, field)',
        'isregularatoryProduct': this.isregularatoryProducts(element[index].name),
        'placeholder': 'Typeahead States',
        'search$': (term) => {
          if (term && term.length > 2) {
            this._http.get<any>(AppConstants.wkApiUrl.producerCode).subscribe(result => {
              const product = result.paginationData.map(key => key['name']);
              const filteredProduct = product.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1).slice(0, 10);
              return of(filteredProduct);
            })
          } else {
            return of([]);
          }

          // const states = this.states.map(key => key['name']);

          // if ((!term || term === '')) {
          //   return of(states);
          // }

          // return of(states.filter(v => v.toLowerCase().indexOf(term.toLowerCase()) > -1));

        },
      },
    });
  }
Faizal
@faizu88
Can somebody help me...
https://stackblitz.com/edit/angular-vkyxwc?file=src%2Fapp%2Fapp.component.ts
The form valid state seems to be not working. It will only work if we check the form state inside the setTimeout
Why this is happening?
Abdellatif Ait boudad
@aitboudad
@faizu88 the form is not constructed yet during on init, we may provide an output to get notified once the form is built, in the meantime, you may use the following workaround https://stackblitz.com/edit/angular-vkyxwc-qgwfdt?file=src/app/app.component.ts
Faizal
@faizu88
@aitboudad Thank you!!